personal.xls

General Macro Scheduler discussion

Moderators: Dorian (MJT support), JRL

Post Reply
snapper1969
Pro Scripter
Posts: 50
Joined: Fri Mar 23, 2007 10:14 am

personal.xls

Post by snapper1969 » Tue Jan 31, 2012 10:31 am

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

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Jan 31, 2012 11:05 am

Try specifying the following for the macro name:

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?

snapper1969
Pro Scripter
Posts: 50
Joined: Fri Mar 23, 2007 10:14 am

Post by snapper1969 » Tue Jan 31, 2012 3:38 pm

mtettmar wrote:Try specifying the following for the macro name:

PERSONAL.XLS!Name of your Macro here
Hi Marcus, the code is below:

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
I can see the personal.xls macro in test.xls. When I run the script I get an error saying it can't find personal.xls and I can't see personal.xls macro in the test.xls. When I close test.xls I can see the personal.xls macro again. Any ideas?.

Thx,

John

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Wed Feb 01, 2012 11:12 am

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.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

snapper1969
Pro Scripter
Posts: 50
Joined: Fri Mar 23, 2007 10:14 am

Post by snapper1969 » Wed Feb 01, 2012 12:14 pm

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.
Thanks Marcus,

I think I'll probably try and recode it in VBScript, better than opening another spreadsheet.

John

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts