0
votes

Trying to find out how to call a Macro from the command line within a pptm file on Macosx using Microsoft Powerpoint for Mac 2011 Version 14.7.3 on Mac OS Sierra I found some suggestions to use Applescript.

https://www.experts-exchange.com/questions/28754099/Run-Office-2011-VBA-macro-from-AppleScript-on-OS-X-Yosemite.html

suggest:

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

which doesn't work for me.

https://lists.apple.com/archives/applescript-users/2013/Jan/msg00216.html suggests:

osascript << EOF
tell application "Microsoft Powerpoint"
  activate
  open ":Users:me:folder:macros.pptm"
  run VB macro macro name "check" list of parameters {"i", 1}
  --quit
end tell
EOF

which gives the error message:

128:187: execution error: „Microsoft PowerPoint“ hat einen Fehler erhalten: Fortfahren nicht möglich: run VB macro. (-1708)

I tried the same with Microsoft Excel according to:

https://answers.microsoft.com/en-us/msoffice/forum/msoffice_excel-mso_mac/how-to-run-a-vba-macro-excel-2011-from-applescript/8f7b1443-9b65-4b37-bcec-73ccb80fdcb1

using the following bash script:

osascript << EOF
tell application "Microsoft Excel"
  activate
  open ":Users:me:folder:check.xlsm"
  run VB macro "Blatt1.check"
  quit
end tell
EOF

which works.

What do I need to do to get the powerpoint equivalent working?

1

1 Answers

1
votes

Correct syntax for PowerPoint is :

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

Assuming that front PowerPoint document contains the macro.