S
Steve
' IN EXECUTING A WORD MACRO FROM AN EXCEL MACRO USING AUTOMATION,
' WHAT IS THE SYNTAX FOR PASSING ARGUMENTS TO THE WORD MACRO?
'From EXCEL macro
Set oWord = GetObject(, "Word.application")
oWord.Visible = True
oWord.WindowState = wdWindowStateMinimize
' works when no argument present
oWord.Run MacroName:="MyWordMacro1"
' does NOT work with argument using this syntax
oWord.Run MacroName:="MyWordMacro1" arg1
-------------------------------------------------------------------------------------
WORD macros
Sub MyWordMacro1()
'
' macro code
'
end sub
Sub MyWordMacro2(arg1 As String)
'
' macro code
'
end sub
' WHAT IS THE SYNTAX FOR PASSING ARGUMENTS TO THE WORD MACRO?
'From EXCEL macro
Set oWord = GetObject(, "Word.application")
oWord.Visible = True
oWord.WindowState = wdWindowStateMinimize
' works when no argument present
oWord.Run MacroName:="MyWordMacro1"
' does NOT work with argument using this syntax
oWord.Run MacroName:="MyWordMacro1" arg1
-------------------------------------------------------------------------------------
WORD macros
Sub MyWordMacro1()
'
' macro code
'
end sub
Sub MyWordMacro2(arg1 As String)
'
' macro code
'
end sub