Excel with Macro

A

Alan Tang

Hello:

Is it possible to execute a macro with command line parameter?

Thanks!
 
J

JulieD

Hi Alan

you can put Workbook_Open code against the ThisWorkbook module

(right mouse click on a sheet tab, choose view code ... look for the
workbook name in bold on top left - choose view / project explorer if you
can't see it... under the workbook name you'll see ThisWorkbook - double
click on it ... on drop down on left hand side of white paper on right hand
side of screen choose Workbook .. )

which will fire when the workbook opens (as long as macros are enabled or
security set to low (not recommended)) ... you can then open this workbook
from a command line, e.g.

excel.exe c:\temp\mybook.xls

Hope this helps
Regards
JulieD
 
Top