通过 VBA 添加按钮到 Outlook 主应用程序窗口的功能区 UI?

问题描述 投票:0回答:1

简单的谷歌搜索得到了this答案

它指出:

您必须将 CustomUI.XML 添加到文件中,其中包含链接到按钮的 VBA 代码的 XML 代码

接下来,迭代揭示了 MS Word VBA 编程通常是如何完成的:

(代码取自此处

Sub ShowCustomXmlParts() 
    On Error GoTo Err 
 
    Dim cxp1 As CustomXMLPart 
 
    Dim cxn As CustomXMLNode 
    Dim cxns As CustomXMLNodes 
    Dim strXml As String 
    Dim strUri As String 
 
        ' Example written for Word. 
 
        ' Add a custom XML part. 
        ActiveDocument.CustomXMLParts.Add "<custXMLPart />" 
 
        ' Returns the first custom XML part with the given root namespace. 
        Set cxp1 = ActiveDocument.CustomXMLParts("urn:invoice:namespace")         
 
        ' Get a node using XPath.                              
        Set cxn = cxp1.SelectSingleNode("//*[@quantity < 4]")  
     
    Exit Sub 
                 
' Exception handling. Show the message and resume. 
Err: 
        MsgBox (Err.Description) 
        Resume Next 
End Sub

但是我找不到与上述代码相应的 Outlook 等效项。找不到

CustomXMLParts
对象引用!我是不是缺少DLL?! 🤔

vba outlook ribbonx
1个回答
0
投票

Outlook 不支持通过 VBA 自定义 UI。您能做的最好的事情就是将 VBA 子项分配给 Outlook 中的 QAT 按钮。否则,如果您需要在其中放置自定义命令,则需要开发 Outlook 加载项。

对于 COM (VSTO) 加载项,请参阅演练:使用功能区设计器创建自定义选项卡

对于 Web 插件,您可以考虑添加功能区命令,与 COM 插件为 Fluent UI 提供的命令相比,它们仍然受到限制,请参阅插件命令了解更多信息。

© www.soinside.com 2019 - 2024. All rights reserved.