Hi,
I got a script which can open an excel sheet & run a macro. I want the script to run more than one macro in that paricular sheet.
I am pasting the script below. Cn anyone help on this
//Put this VBScript block at top of script
VBSTART
Sub OpenAndRun(xlFileName, MacroName)
Set xlApp = CreateObject("Excel.Application")
'remove next line to make Excel invisible
xlApp.visible = true
Set xlBook = xlApp.WorkBooks.Open(xlFileName)
xlApp.Run(MacroName)
'Uncomment next line to quit Excel
'xlApp.quit
End Sub
VBEND
//Use this line when you want to run the Excel macro:
VBRun>OpenAndRun,C:\Documents and Settings\wedws\Desktop\excel.xls,Macro1[/b]
[/code]
Nedd help to run multiple macros - Urgent!!!!!!!!!!!!!!
Moderators: Dorian (MJT support), JRL
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Just add more of these lines:
xlApp.Run(MacroName)
As many as you like.
You may want to split the VBScript into two/three functions - one to open the Excel book, one to run all the macros, one to close the book.
xlApp.Run(MacroName)
As many as you like.
You may want to split the VBScript into two/three functions - one to open the Excel book, one to run all the macros, one to close the book.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?