We help IT Professionals succeed at work.
Get Started

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

930 Views
Last Modified: 2016-02-11
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?
Comment
Watch Question
Commented:
This problem has been solved!
Unlock 2 Answers and 4 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE