PDA

View Full Version : A tricky one - Script starting excel with macro


bojankus
01-21-2005, 02:45 AM
hello,

im trying to start excel with macro in it and than start the macro...i dont know what commands must i use in vbs to start excel than set "Enable macro" and for the cheery on top start the macro...

ehhhmm...a little help woud be appreciated mucho...

nice day everyone,
Bojankus

jdev
01-24-2005, 02:55 PM
I think that you can circumvent the problem altogether by signing your macro code, which will cause a macro to be executed automatically, without the security prompt. For more information, search in Excel's help for steps to digitally sign a macro project.

wasodg2
02-14-2005, 09:28 AM
'Code for running excel macro in vbs
Dim xlApp
Dim xlWkb


Set xlApp = CreateObject("excel.application")
Set xlWkb = xlApp.Workbooks.Open("YOUR WORKBOOK")

xlWkb.RunAutoMacros 1 'xlautoopen
xlApp.Run ("YOUR MACRO")

xlApp.Visible = True
Set xlWkb = Nothing
Set xlApp = Nothing

More info here
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbaac11/html/acmthactRunMacro_HV05186508.asp

Hope this helps