Hi,
I have a macro saved to personal.xls but when I try to run it via a scheduler it says that the macro can't be found. Is there a problem with running macros in personal.xls?.
Thx,
John
personal.xls
Moderators: Dorian (MJT support), JRL
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Try specifying the following for the macro name:
PERSONAL.XLS!Name of your Macro here
PERSONAL.XLS!Name of your Macro here
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?
-
- Pro Scripter
- Posts: 50
- Joined: Fri Mar 23, 2007 10:14 am
Hi Marcus, the code is below:mtettmar wrote:Try specifying the following for the macro name:
PERSONAL.XLS!Name of your Macro here
Code: Select all
BSTART
Sub OpenAndRun(xlFileName, MacroName)
Set xlApp = CreateObject("Excel.Application")
xlApp.visible = true
Set xlBook = xlApp.WorkBooks.Open(xlFileName)
xlApp.Run(MacroName)
End Sub
VBEND
VBRun>OpenAndRun,l:\test.xls,PERSONAL.XLS!Autofilter
Thx,
John
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Having spent some time googling this I don't think personal.xls is opened by default when Excel is instantiated as COM object. Try opening personal.xls as well, e.g.:
VBRun>OpenAndRun,C:\Users\User\AppData\Roaming\Microsoft\Excel\XLSTART\personal.xlsb,TestMacro
But I guess you might actually need to modify the VBScript function to open both personal.xlsb and your test.xls doc if you are wanting to affect something inside test.xls
It might be easier to move the macro to test.xls. Or you could recode it in VBScript and run directly inside Macro Scheduler.
VBRun>OpenAndRun,C:\Users\User\AppData\Roaming\Microsoft\Excel\XLSTART\personal.xlsb,TestMacro
But I guess you might actually need to modify the VBScript function to open both personal.xlsb and your test.xls doc if you are wanting to affect something inside test.xls
It might be easier to move the macro to test.xls. Or you could recode it in VBScript and run directly inside Macro Scheduler.
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?
-
- Pro Scripter
- Posts: 50
- Joined: Fri Mar 23, 2007 10:14 am
Thanks Marcus,mtettmar wrote:Having spent some time googling this I don't think personal.xls is opened by default when Excel is instantiated as COM object. Try opening personal.xls as well, e.g.:
VBRun>OpenAndRun,C:\Users\User\AppData\Roaming\Microsoft\Excel\XLSTART\personal.xlsb,TestMacro
But I guess you might actually need to modify the VBScript function to open both personal.xlsb and your test.xls doc if you are wanting to affect something inside test.xls
It might be easier to move the macro to test.xls. Or you could recode it in VBScript and run directly inside Macro Scheduler.
I think I'll probably try and recode it in VBScript, better than opening another spreadsheet.
John