From "Microsoft Visual Basic Help":
"The Visual Basic Command function is not available in Microsoft Office
applications."
So forget about the command() function.
You might have to consider using Office Automation.
If you are familar with visual basic you can do automation with Windows
Scripting Host:
- create a Windows Scripting Host file that creates an excel application
object.
- call the run method on the object passing the macro name that you want to
execute + command line arguments
Something like this:
' ---------------------------
' automate.vbs
' ---------------------------
Dim app, wb, args
Set args = WScript.Arguments
Set app = CreateObject("Excel.Application")
Set wb = app.Workbooks.Open("c:\myfile.xls")
app.Run "Module1.MyMacro", args(0)
wb.Close
app.Quit
Set wb = Nothing
Set excel = Nothing
' ---------------------------
Try calling automate.vbs from command line prompt, e.g.
c:\> automate.vbs param1 param2
Hope this helps -- arunkhemlai
(e-mail address removed)