如何让 Powerpoint 在动画中调用我的 VBA 子例程?

发布于 2024-09-15 08:44:57 字数 800 浏览 1 评论 0原文

我最终想要做的是每次新幻灯片出现在我的 PowerPoint 幻灯片放映中时,ShellExecute() 都是一个命令行程序。我正在使用 Office 2003 PowerPoint。

我执行了以下操作:

  1. 工具>选项>安全选项>宏安全>安全级别 = 中

  2. 工具 > 选项 >> VBA 编辑器:

    Sub OnSlideShowPageChange(ByVal SSW As SlideShowWindow)
      MsgBox(“OnSlideShowPageChange”)
    结束子
    
  3. 文件> 保存

  4. 返回 PowerPoint:F5(用于幻灯片放映 > 查看放映)。 没有看到消息框

  5. 退出 PowerPoint,重新打开 .ppt 文件,再次F5)。 仍然看不到消息框

问题:我错过了什么?为什么当我运行幻灯片放映时 OnSlideShowPageChange 没有被调用???

What I ultimately want to do is ShellExecute() a command-line program every time a new slide appears in my PowerPoint slide show. I'm using Office 2003 PowerPoint.

I did the following:

  1. Tools > Options > Security Options > Macro Security > Security Level = Medium

  2. Tools > Options > Macro > VBA Editor:

    Sub OnSlideShowPageChange(ByVal SSW As SlideShowWindow)
      MsgBox ("OnSlideShowPageChange")
    End Sub
    
  3. File > Save

  4. Back to PowerPoint: F5 (for Slide Show > View Show). Did NOT see the message box

  5. Exit out of PowerPoint, reopen the .ppt file, F5) again. Still don't see the message box

Question: What am I missing? Why isn't OnSlideShowPageChange getting invoked when I run the slide show???

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

女中豪杰 2024-09-22 08:44:57

它对我来说工作得很好,完全按照您上面的步骤操作。我唯一能想到的是在上面的步骤 #2 中,您可能已将自动宏 OnSlideShowPageChange 放入类或用户窗体中。它应该进入一个模块(任何模块,任何名称)。或者您是否还有其他可能会干扰的代码,例如您是否还接收了 SlideShowNextSlide 事件?

It's working just fine for me, using exactly your steps above. The only think I can think of is on step #2 above, you may have put the automacro OnSlideShowPageChange in a Class or UserForm. It should go into a Module (any module, any name). Or do you have other code in there that may be interfering, like are you also sinking the SlideShowNextSlide event?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文