C
Crisp
I have been trying to pass a parameter to a word macro upon startup, launched
from a VBS script. The VBS script t allows you to drag and drop a file to
it. I wanted it to launch word, which would open the file it was dropped,
and then run the "testLaunch" macro upon startup with the testMsg parameter.
I tried the following, which did not crash, brought up Word with the correct
file, but the macro did not appear to work...
VBS Script:
Set objArgs = WScript.Arguments
doublequote = chr(34)
testMsg = "Hi Cris!"
wordPath = "winword.exe /mtestLaunch(testMsg) " & doublequote
For I = 0 to objArgs.Count - 1
runStr = wordPath & objArgs(I) &doublequote
WScript.Echo runStr
set objShell=CreateObject("Wscript.Shell")
objShell.Run(runStr)
Next
the word macro looks like:
Sub testLaunch(testMsg)
MsgBox testMsg, , "It worked!"
End Sub
Suggestions anyone?
from a VBS script. The VBS script t allows you to drag and drop a file to
it. I wanted it to launch word, which would open the file it was dropped,
and then run the "testLaunch" macro upon startup with the testMsg parameter.
I tried the following, which did not crash, brought up Word with the correct
file, but the macro did not appear to work...
VBS Script:
Set objArgs = WScript.Arguments
doublequote = chr(34)
testMsg = "Hi Cris!"
wordPath = "winword.exe /mtestLaunch(testMsg) " & doublequote
For I = 0 to objArgs.Count - 1
runStr = wordPath & objArgs(I) &doublequote
WScript.Echo runStr
set objShell=CreateObject("Wscript.Shell")
objShell.Run(runStr)
Next
the word macro looks like:
Sub testLaunch(testMsg)
MsgBox testMsg, , "It worked!"
End Sub
Suggestions anyone?