Powerpoint VBA 宏另存为对话框文件过滤器 [英] Powerpoint VBA Macro Save As Dialog File Filter

查看:77
本文介绍了Powerpoint VBA 宏另存为对话框文件过滤器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

这有效,但我需要另存为对话框"的代码,用户可以在其中选择将文件另存为 html 的路径(用户只能选择另存为 html",别无其他).

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).

这是我的 SaveAsDialog 的代码

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

但现在,我需要一个 .html 文件的文件过滤器.

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

推荐答案

带有 vb 过滤器的 MS Office SaveAs 类型 FileDialog 声明遗憾的是,自定义过滤器不能用于另存为对话框.

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

所以似乎最好的选择是使用 Windows API 作为 OP 建议的答案.

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

这篇关于Powerpoint VBA 宏另存为对话框文件过滤器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆