its very limited.
what you can do is create a VBScript file that can open excel & you can pass
arguments to this...
so create a workbook here: C:\temp\DemoBook4.xls
add this procedure to a standard code module:=
Option Explicit
Sub DemoRoutine(a As String, b As String, c As String)
MsgBox a & vbCrLf & b & vbCrLf & c
End Sub
Onto your desktop, add a new textfile, call it anything you like, but change
the .TXT extension to .VBS
wdir with Notepad and paste this:-
option explicit
dim wb
dim xl
set xl = CreateObject("Excel.Application")
set wb = xl.workbooks.Open( "C:\temp\DemoBook4.xls")
xl.visible = true
xl.run
"DemoRoutine",wscript.arguments.item(0),wscript.arguments.item(1),wscript.arguments.item(2)
wb.Close False
xl.quit
set wb = nothing
set xl = nothing
open a command window
type
cd desktop [return]
"new text document.vbs" "a" "b" "c"
basically you're running a VBScript file and passing three arguments to it.
The script opens an excel file and calls the procedure, passing to it the
three variables...which you see in the excel mssage
Trefor said:
If it possible to read an arg from the command line in VBA?
myworkbook.xls arg1 arg2
I would like to run a certain macro if a certain argument or parameter is
specified.