Run Office:2011 VBA macro from AppleScript (on OS X Yosemite)

I have seen several methods for running macros from AppleScript on the web but none seem to work. This is the one that looks closest to being relevant for Office:mac 2011:

tell application "Microsoft PowerPoint"
activate
run VB macro "myMacroName"
end tell

Open in new window


But no matter what I put after run VB macro, the script editor keeps throwing this error:

Syntax Error
Expected end of line, etc. but found identifier.


So I opened the relevant dictionary in the script editor to check that the method exists using File / Open Dictionary, selecting the relevant Microsoft Office:mac application and searching for run VB macro I found this:

AppleScript-run-VB-macro.png
This looks like the macro name and optional parameters are supposed to be on separate lines but that throws the same error.

If it's possible to run a macro and this issue is resolved, where can the macro reside? Only in an open document or can it be called within an installed VBA application add-in too?
LVL 15
Jamie GarrochSenior Technical Consultant at BrightCarbonAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

strungCommented:
Try
tell application "Microsoft PowerPoint"
activate
tell active workbook
run VB macro "myMacroName"
end tell
strungCommented:
or:

tell application "Microsoft PowerPoint"
activate
run VB macro macro name "myMacroName"
end tell

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jamie GarrochSenior Technical Consultant at BrightCarbonAuthor Commented:
run VB macro macro name "myMacroName" is definitely part of the answer but it was still creating an error.

I think I found the other part.

This doesn't work:
tell application "Microsoft PowerPoint"

Open in new window

And in fact, for some bizarre reason it's autocorrecting it to this:
tell application "Microsoft PowerPoint x64"

Open in new window

Which is the Windows version of PowerPoint 2013 running in Parallels!

So, that lead me to think more explicitly:
tell application "Macintosh HD:Applications:Microsoft Office 2011:Microsoft PowerPoint"

Open in new window

But that didn't work either.

However, by simply adding .app to the end, this does!
tell application "Macintosh HD:Applications:Microsoft Office 2011:Microsoft PowerPoint.app"

Open in new window

Even better, it's allowing me to call publicly declared macros in a loaded PPAM add-in :-)

I am left wondering why the simple "Microsoft PowerPoint" doesn't work and if my solution is safely deployable to multiple machines.
Jamie GarrochSenior Technical Consultant at BrightCarbonAuthor Commented:
The solution required two changes to the original code, one from user strung and one from myself after more reading/prototyping/testing
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Mac OS X

From novice to tech pro — start learning today.