问题描述
我想在 PowerPoint ppam 中使用来自某些自定义 XML 的 getLabel 回调,以便本地化功能区中的文本。我担心这样做可能会导致在启动 PowerPoint 时不时出现错误消息(“PowerPoint 无法启动此功能,因为您当前有一个处于中断模式的 Visual Basic for Applications 项目。”)如 users have experienced with an add-in that uses a getEnabled callback .我有already asked a question about other options for localising the ribbon。
您是否在 PowerPoint ppam 加载项中使用 getLabel?如果是这样,您是否有时在 PowerPoint 启动时看到此错误消息?此外,您是否使用了 getEnabled,这是否会导致在 PowerPoint 启动时显示此错误消息?
无论哪种方式的答案都会很棒。
这是我正在测试的内容:
自定义 UI XML 片段:
<button id="app1ShowAMsg"
imageMso="TableInsert"
size="normal"
onAction="app1ShowAMessage"
label="app1GetLabel"/>
VBA 代码:
Public Sub app1GetLabel(control As IRibbonControl,ByRef returnedVal)
Select Case control.Id
Case "app1ShowAMsg"
returnedVal = "My added label"
End Select
End Sub
Public Sub app1ShowAMessage()
MsgBox "You clicked a button."
End Sub
解决方法
是的,是的。我认为将 getLabel
回调与其他回调一起使用没有任何奇怪之处。此外,这是在 Fluent UI 上实现任何动态的推荐方法 - 用于在运行时更改标题字符串等。 Fluent UI 在以下系列文章中进行了深入介绍:
- Customizing the 2007 Office Fluent Ribbon for Developers (Part 1 of 3)
- Customizing the 2007 Office Fluent Ribbon for Developers (Part 2 of 3)
- Customizing the 2007 Office Fluent Ribbon for Developers (Part 3 of 3)
您可能还会发现以下文章很有帮助: