1

I am trying to use C# PowerPoint interop to enable the "Save Preview Picture" option on a PowerPoint presentation.

enter image description here

I am looking at MSDN Presentation Properties but cannot see a property to save a thumbnail or similar.. Is it possible?

JKennedy
  • 18,150
  • 17
  • 114
  • 198
  • http://stackoverflow.com/questions/2972263/ppt-slides-to-images this may help? – horHAY Apr 14 '15 at 14:08
  • @horHAY sadly not. The "Save preview picture" option is used to embed a thumbnail of the first slide into the file which explorer then uses. The problem is this option is tucked away behind many menus and I would like to provide a quick way to enable this property – JKennedy Apr 14 '15 at 14:10

2 Answers2

0

In case it proves useful, here's a bit of VBA that will display the values of all the built-in document properties. Some will throw errors if the presentation has not yet been saved. Unfortunately, SavePreviewPicture or the like isn't on the list.

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
Steve Rindsberg
  • 14,442
  • 1
  • 29
  • 34
  • Thanks for the info. I checked the `BuiltInDocumentProperties` and the list matches up with the one outlined [here](https://msdn.microsoft.com/en-us/library/microsoft.office.tools.excel.workbook.builtindocumentproperties.aspx) which doesn't have a "Save Preview Image" property. `CustomDocumentProperties` has 0 items but I'm guessing thats the right direction although I'm not sure its possible to do what I want – JKennedy Apr 15 '15 at 09:15
  • It might be worth poking around in the XML (save as PPTX, change the file extension to ZIP and have at it). I tried that too w/o running across anything likely-looking. But a thought: save the file with the option checked, change NOTHING, other than the checkmark and save again to a different file. Then compare all the contents of the XML. – Steve Rindsberg Apr 15 '15 at 15:33
  • I discovered that there is an XML property for this in Word called savePreviewPicture which is found in word/settings.xml but there is no such property for PowerPoint or Excel. I then discovered that if the file in the PowerPoint Open XML archive\ docProps\thumbnail.jpeg exists, the corresponding UI checkbox is checked and if it doesn't, it's not checked. So PowerPoint doesn't appear to have a property related to this checkbox and instead just uses the presence of the thumbnail.jpeg file so set this in the UI. – Jamie Garroch - MVP Jan 31 '20 at 19:20
0

This is a workaround. You just have to interact with the properties dialog twice. And translate menu names in the marcro to your Office Language

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
JKennedy
  • 18,150
  • 17
  • 114
  • 198