PowerPoint 2007/2010 VBA ppam 加载项在打开时不显示在 VBA 编辑器中
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5129362/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
PowerPoint 2007/2010 VBA ppam Add-In does not show up in VBA editor when open
提问by ak112358
I've created a PowerPoint 2007/2010 VBA Add-In (.ppam) some code in a module. I've also added an XML ribbon (not important, but it shows me that the file is in fact open in PowerPoint). I can click a button in the ribbon I created and it will execute code from my module. cool.
我在一个模块中创建了一个 PowerPoint 2007/2010 VBA 加载项 (.ppam) 一些代码。我还添加了一个 XML 功能区(不重要,但它表明该文件实际上已在 PowerPoint 中打开)。我可以单击我创建的功能区中的一个按钮,它将执行我的模块中的代码。凉爽的。
When I open the VBA editor (ctrl + F11), the Add-In does not show up. In fact, if I don't have another document open I can't even open the editor. I've tried this in PowerPoint 2007 and 2010.
当我打开 VBA 编辑器 (ctrl + F11) 时,加载项没有出现。事实上,如果我没有打开另一个文档,我什至无法打开编辑器。我已经在 PowerPoint 2007 和 2010 中尝试过这个。
How can I edit the code of a PowerPoint Add-In I've already created? I've made many VBA Add-Ins in Excel, but maybe PowerPoint is different (am I crazy)?
如何编辑已创建的 PowerPoint 加载项的代码?我在 Excel 中制作了许多 VBA 加载项,但也许 PowerPoint 不同(我疯了)?
回答by Steve Rindsberg
Late to the party here, but for the sake of completeness, there's one other very useful trick people might want to be aware of.
迟到了,但为了完整起见,人们可能还想知道另一个非常有用的技巧。
- Close PPT if it's running
- In REGEDIT, go to
HKCU\Software\Microsoft\Office\xx.0\PowerPoint\Options
(where xx.0 is 11.0 for Office 2003, 12.0 for Office 2007, 14.0 for Office 2010) - Add
DebugAddins
aDWORD=1
- Quit regedit.
- 如果正在运行,请关闭 PPT
- 在 REGEDIT 中,转到
HKCU\Software\Microsoft\Office\xx.0\PowerPoint\Options
(其中 xx.0 是 Office 2003 的 11.0、Office 2007 的 12.0、Office 2010 的 14.0) - 添加
DebugAddins
一个DWORD=1
- 退出注册表。
Add-ins will now appear in the IDE; you can modify them, run them, test them, basically do anything but SAVE them, so after your code is debugged, export any modules/forms/classes you've changed so you can import them into the PPT/PPTM that contains your code and save as add-in again.
插件现在将出现在 IDE 中;你可以修改它们,运行它们,测试它们,基本上除了保存它们之外什么都做,所以在你的代码被调试之后,导出你改变的任何模块/表单/类,这样你就可以将它们导入包含你的代码的 PPT/PPTM并再次另存为加载项。
This can save hours of debugging tedium/time.
这可以节省数小时的调试乏味/时间。
回答by Todd Main
You cannot directly edit a .ppam as it is sort of "compiled". The way to do this is maintain all your code/customizations in a .pptm (and make sure you keep that .pptm as a .pptm) and when you want to test it as an add-in, do a "Save As.." to a .ppam and then load it. Not happy with it? Go back to your .pptm and make the changes there.
您不能直接编辑 .ppam,因为它是“编译”的。这样做的方法是在 .pptm 中维护所有代码/自定义(并确保将该 .pptm 保留为 .pptm),并且当您想将其作为加载项进行测试时,请执行“另存为.. " 到 .ppam 然后加载它。不满意吗?返回到您的 .pptm 并在那里进行更改。
BTW, if you don't want to use the Ribbon just to ensure it has loaded as an add-in, just use an AutoOpen macro (in any module), like:
顺便说一句,如果您不想使用功能区来确保它已作为加载项加载,只需使用 AutoOpen 宏(在任何模块中),例如:
Sub Auto_Open()
MsgBox "My add-in has loaded"
End Sub
You can remove that AutoOpen macro later, once you're satisfied with your add-in.
一旦您对加载项感到满意,您可以稍后删除该 AutoOpen 宏。