View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Cone Jim Cone is offline
external usenet poster
 
Posts: 3,290
Default Need syntax for RUNning a Word macro with an argument, called from an Excel macro

It doesn't appear as if Macro1 has any arguments?
Try this for Macro2, add a comma at the end of the called macro name.
If it still doesn't work then remove the argument name...
oWord.Run "MyWordMacro2", arg1

Curious:
does the Word application actually minimize?
why do you make the application visible and then minimize it?
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"Steve"
wrote in message

'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