Start Word Macro with variable

ingrid

Registered User.
Local time
Today, 17:12
Joined
Apr 10, 2003
Messages
42
If want to start a Word macro from Access. For this I use the code which stands under. Is it possible to give a variable that can be used in the macro?

' Word starten
Dim WordApp As Object
Set WordApp = CreateObject("Word.Application")
WordApp.Visible = True

' macro starten
WordApp.Application.Run "StandVanZaken"
Set WordApp = Nothing

The Function in Word start with StandVanZaken(string), en the string I want to give in access.

I hope you understand what I mean, because my English is not so good :)
 
You can post in Dutch as well :) Greets from Amsterdam

to call a macro in word with parameters use:

WordApp.Application.Run "StandVanZaken", Varg1:=YourVariable

You can add as many as you want (up to 30)
WordApp.Application.Run "StandVanZaken", Varg1:=YourVariable, Varg2:=Your2,Varg.., Varg30:="Something"

I however dont see the need to call a macro in word, why not use automation calling everything you need to do from Access instead of using this "sloppy" way?

Regards

The Mailman
 

Users who are viewing this thread

Back
Top Bottom