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

时间:2019-03-27 13:15:23

标签: vba vsto powerpoint powerpoint-vba office-addins

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

Microsoft通过Office 365在PowerPoint中引入了一项称为设计思想的新功能。 (这是“设计”选项卡上的最后一项)。当我们使用此外接程序时,有趣的是,删除了演示文稿中存储的CustomDocuementProperty。

Design Ideas

使用以下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

我找到了一个解决方案,就是使用Presentation Tags代替CustomDocumentProperties,但是当前的代码库在很大程度上依赖于后者,这就是为什么我在寻找其他可能更简单的替代方法。

此外,我们可以通过外接程序以某种方式禁用此功能吗?

0 个答案:

没有答案