passing parameters to macro from command line

P

Pratima

This is my macro sample :

Sub OpenDoc(filename)
Document.Open filename
End Sub

I am invoking it from command line as follows :

"C:\Program Files\Microsoft Office\Office10
\WINWORD.EXE" "/mOpenDoc"

I need to pass the value of the filename parameter. How
can I pass the parameter value from command line ?
 
D

Dave Lett

Hi Pratima,

I don't think you can pass a parameter to a macro from a command line.
However, you can include a filename in the command line, as in the
following:

"C:\Program Files\Microsoft Office\Office10\WINWORD.EXE" C:\Test.doc
/mRunTestMacro

HTH
 
C

Chip Orange

I am trying to do just this, but it is failing to run the macro. Would you
have any ideas as to why? (If i do it manually, all is fine). Is it
possible that the macro is running before the document is loading?

thanks.

Chip
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top