Powerpoint VBA宏另存为对话框文件过滤器

时间:2014-03-27 11:00:47

标签: vba powerpoint savefiledialog filefilter

我想将PPT演示文稿导出为.html文件。因此我有VBA代码

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

这有效,但我需要“另存为对话框”的代码,用户可以选择将文件保存为html的路径(用户只能选择“另存为html”,没有别的)

这是我的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

但是现在,我需要.html文件的文件过滤器。

1 个答案:

答案 0 :(得分:1)

MS Office SaveAs type FileDialog with a filter in vb表示不幸的是,自定义过滤器无法用于“另存为”对话框。

所以似乎最好的选择是使用Windows API创建对话框,作为OP建议的答案。