Excel filename command line parameter to VB

M

mark

I'd like to execute a macro in Excel automatically using a
VB .exe file. I can do that, but would like to have the
VB file be generic so that it can just receive the
specific Excel file's name as a command line parameter.

Can someone show me how to receive that, in VB? An
example of which portion of the code starts to use it? I
don't think I'm wording this well... sorry.
 
B

Bob Phillips

Mark,

In you program read the parameters using the "Command" function.

Sub Main()
Dim sParam As String

sParam = Command()
MsgBox "The parameters are: " & sParam

End Sub

If you pass more than one parameter, e.g. myProj param1, param2, then you
can parse it to separate it out.
 

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