简体   繁体   中英

Powerpoint VBA Macro Save As Dialog File Filter

I want to export a PPT presentation to an .html file. Therefore I have the VBA code

Sub HTMLExport()
    ActivePresentation.SaveAs "C\Users\test\pptInHtml.htm", ppSaveAsHTML, msoFalse
End Sub

This works, but I need the code for a "Save As Dialog Box", where the user can choose the path where the file will be saved as html (the user can only pick "save as html", nothing else).

This is the code for my SaveAsDialog

Sub ShowSaveAsDialog()
Dim dlgSaveAs As FileDialog
Set dlgSaveAs = Application.FileDialog(msoFileDialogSaveAs)
With dlgSaveAs
  If .Show = -1 Then
    .Execute
  End If
End With
End Sub

But now, I need the file filter for an .html file.

MS Office SaveAs type FileDialog with a filter in vb states that custom filters unfortunately cannot be used for a Save As dialog.

So it seems like the best option is to create the dialog using Windows API as the answer by the OP suggests.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM