vba Word 在消息框中显示多个标签

vba Word show multiple Tags in Msgbox

我想使用 Messagebox 显示多个标签。

  1. 我打开新的 Word 文档并转到后台/信息并输入属性 标题:词标签 标签:红色;蓝色;绿色

  2. 我故意使用 分号而不是逗号,因为在资源管理器中我可以在搜索框中使用 Tags:Red 并且它发现所有红色标记文档。

  3. 以下代码对显示标题有效,但在显示标签时出错:

    Sub MsgBox_Tags()
    
    Dim sTitle As String
    
    Dim sTags As String
    
    sTitle = ActiveDocument.BuiltInDocumentProperties("Title").Value
    
    MsgBox sTitle
    
    sTags = ActiveDocument.BuiltInDocumentProperties("Tags").Value
    
    MsgBox  sTags
    
    End Sub

MessageBox 标题有效,但随后 运行 时间错误“5”无效过程调用或参数

欢迎任何帮助!

虽然它在 Backstage 视图中显示为“标签”,但实际上是“关键字”属性。您可以通过显示“属性”对话框来查看 - 在 Backstage 视图中单击“属性”和“select 高级属性”。

Sub MsgBox_Tags()
   Dim sTitle As String
   Dim sTags As String

   sTitle = ActiveDocument.BuiltInDocumentProperties("Title").Value
   MsgBox sTitle

   sTags = ActiveDocument.BuiltInDocumentProperties("Keywords").Value
   MsgBox sTags

End Sub