FileDialog.DialogType 属性 (Office)
获取一个 MsoFileDialogType 常量,该常量代表 FileDialog 对象设置为显示的文件对话框的类型。 此为只读属性。
语法
表达式。DialogType
expression 一个代表 FileDialog 对象的变量。
示例
下面的示例将 FileDialog 对象视为未知类型,并且如果是“另存为”对话框或“打开”对话框,则运行 Execute 方法。
Sub DisplayAndExecuteFileDialog(ByRef fd As FileDialog)
'Use a With...End With block to reference the FileDialog object.
With fd
'If the user presses the action button...
If .Show = -1 Then
'Use the DialogType property to determine whether to
'use the Execute method.
Select Case .DialogType
Case msoFileDialogOpen, msoFileDialogSaveAs: .Execute
'Do nothing otherwise.
Case Else
End Select
'If the user presses Cancel...
Else
End If
End With
End Sub
另请参阅
支持和反馈
有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈