Powerpoint VBA Macro Save As Dialog File Filter

*爱你&永不变心* 提交于 2019-12-11 01:59:44

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!