使用 Office 365 的“设计创意”功能时,为什么 PowerPoint 会重置/清除 CustomDocumentProperties?

Sul*_*mad 5 powerpoint vba vsto office-addins

我们开发了一个 PowerPoint VSTO 加载项。为了同时处理多个演示文稿,我们为每个演示文稿使用唯一的 GUID,并将其存储在 CustomDocumentProperties 中,如此处所述

通过 Office 365,微软在 PowerPoint 中引入了一项名为“设计创意”的新功能。(这是“设计”选项卡上的最后一项)当我们使用此加载项时,有趣的是,存储在演示文稿中的 CustomDocumentProperties 被删除。

设计理念

它可以使用以下 VBA 代码轻松重现。首先,运行 AddCustomProperty 方法并使用 GetCustomProperty 进行验证,然后在幻灯片上使用设计理念。此后,当调用 GetCustomProperty 时,会引发异常。

Public Sub AddCustomProperty()
    On Error Resume Next
    ActivePresentation.CustomDocumentProperties("PresentationID").Value = "bb999da6f94c4692b31106994636d962"
    If Err.Number > 0 Then
        ActivePresentation.CustomDocumentProperties.Add _
            Name:="PresentationID", _
            LinkToContent:=False, _
            Type:=MsoDocProperties.msoPropertyTypeString, _
            Value:="bb999da6f94c4692b31106994636d962"
    End If
End Sub

Sub GetCustomProperty()
    MsgBox ActivePresentation.CustomDocumentProperties("PresentationID")
End Sub
Run Code Online (Sandbox Code Playgroud)

我找到了一个解决方案,即使用演示标签而不是 CustomDocumentProperties,但当前的代码库严重依赖于后者,这就是为什么我正在寻找其他可能更简单的替代方案。

另外,我们可以通过我们的加载项以某种方式禁用此功能吗?