Running an Excel Macro from personal.xlsb

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
Tourless
Pro Scripter
Posts: 69
Joined: Wed Jun 14, 2017 1:53 am
Location: NY

Running an Excel Macro from personal.xlsb

Post by Tourless » Wed Nov 16, 2022 4:13 pm

Hi Folks.

Can someone tell me if this is possible or do I have to drop my entire macro into my script in order for it to perform its operations on my spreadsheet?

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1348
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Running an Excel Macro from personal.xlsb

Post by Dorian (MJT support) » Wed Nov 16, 2022 4:54 pm

Yep, that's what XLRun does. (Requires Macro Scheduler Pro/Std v12.0.0.30 or higher).

Code: Select all

XLOpen>d:\Book3.xlsb,1,xlbook
XLRun>xlbook,Macro1
And just to over-egg the omelette, I also discovered something (pointless) which some may find interesting, if you create a second Excel macro which runs the original Excel Macro, you can use XLRunCode to execute it.

In this case Macro2 simply runs Macro1.

Code: Select all

XLOpen>d:\Book3.xlsb,1,xlbook
XLRunCode>xlbook,Application.Run "Book3.xlsb!Macro2"
Yes, we have a Custom Scripting Service. Message me or go here

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