问题
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.
回答1:
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.
来源:https://stackoverflow.com/questions/22685594/powerpoint-vba-macro-save-as-dialog-file-filter