【问题标题】:how to call a macro in powerpoint 2011 for macos如何在 powerpoint 2011 for macos 中调用宏
【发布时间】:2017-05-11 16:28:23
【问题描述】:

试图找出如何在 Macosx 上使用 Microsoft Powerpoint for Mac 2011 版本 14.7.3 在 Mac OS Sierra 上的 pptm 文件中从命令行调用宏,我发现了一些使用 Applescript 的建议。

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

建议:

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

这对我不起作用。

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

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

给出错误信息:

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

我在 Microsoft Excel 中尝试过同样的方法:

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

使用以下 bash 脚本:

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

哪个有效。

我需要做什么才能使等效的 powerpoint 正常工作?

【问题讨论】:

    标签: macos applescript powerpoint


    【解决方案1】:

    PowerPoint 的正确语法是:

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

    假设前面的 PowerPoint 文档包含宏。

    【讨论】:

    • 1708 在以下情况下发生:宏不存在 - 或宏失败。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多