vbapowerpointpowerpoint-2013

Save PPTM as PPTX Without CustomUI Elements or VBA Macros


I have a Macro Enabled PowerPoint document(PPTM) that I would like to add functionality to "Export" to a non-Macro enabled document(PPTX). I have written the following VBA code to accomplish this:

'Default selected file type PPTX
Dim selected As String: selected = Application.FileDialog(msoFileDialogSaveAs).Show()
Dim filePath As String

If selected <> 0 Then
    filePath = Application.FileDialog(msoFileDialogSaveAs).SelectedItems(1)
    ActivePresentation.SaveCopyAs fileName:=filePath, FileFormat:=ppSaveAsOpenXMLPresentation
End If

This works correctly and saves the document without any of the associated VBA code, however I've included in my source PPTM file a customUI Menu which I would like to remove as well, as the ribbon tab links to the various VBA functions which I have removed.

How can I save to a PPTX without the included CustomUI menu? Is there a way to "remove" the CustomUI menu with VBA(really doesn't look like it, at least in Excel Hide/Show), or can it be hidden without placing VBA method calls with the CustomUI's Load Event(such as this Example)?


Solution

  • In theory it should be possible to save the pptm as a pptx file (removing the VBA code), close it, rename it .zip, delete the customUI folder (which contains customUI.xml) from the zip and then rename it back to .pptx

    I tried this manually and it worked.

    Ron de Bruin has some VBA ZIP code examples here : http://www.rondebruin.nl/win/s7/win001.htm