我可以在PowerPoint演示文稿属性上启用“保存预览图片”

时间:2015-04-14 14:03:12

标签: c# powerpoint thumbnails office-interop

我正在尝试使用C#PowerPoint互操作来启用"保存预览图片" PowerPoint演示文稿上的选项。

enter image description here

我正在查看MSDN Presentation Properties,但无法看到保存缩略图或类似内容的属性。是否可能?

2 个答案:

答案 0 :(得分:0)

如果它证明有用,这里有一些VBA将显示所有内置文档属性的值。如果演示文稿尚未保存,有些人会抛出错误。不幸的是,SavePreviewPicture等不在列表中。

Dim x As Long
On Error Resume Next
With ActivePresentation
    Debug.Print "There are: " & .BuiltInDocumentProperties.Count & " built-in document properties"
    With .BuiltInDocumentProperties
        For x = 1 To .Count
            Debug.Print x & vbTab & .Item(x).Name
            Debug.Print vbTab & .Item(x).Value
            If Err.Number <> 0 Then
                Debug.Print vbTab & "Error: " & Err.Number & vbTab & Err.Description
                Err.Clear
            End If
        Next
    End With
End With

答案 1 :(得分:0)

这是一种解决方法。您只需要与属性对话框进行两次交互。 并将marcro中的菜单名称翻译为您的Office语言

Sub UpdateThumbnailWorkaround()
Dim path As String
Dim vPpt As Presentation

    Dim oCmdbar As CommandBar
    Set oCmdbar = Application.CommandBars("Menu Bar")
    oCmdbar.Controls("&Archivo").Controls("&Propiedades").Execute
    path = ActivePresentation.path & "\" & ActivePresentation.Name
    ActivePresentation.Save
    ActivePresentation.Close
    Set vPpt = Application.Presentations.Open(path)
    'Set ActiveWindow.Presentation = vPpt
    Set oCmdbar = Application.CommandBars("Menu Bar")
    oCmdbar.Controls("&Archivo").Controls("&Propiedades").Execute


    'oCmdbar.Controls("&Archivo").Controls("&Propiedades").Execute
    ActivePresentation.Save
    ActivePresentation.Close
    Application.Presentations.Open (path)        

End Sub