常量msoFileDialogOpen的值为1,表示打开文件对话框,允许选择一个或多个文件,使用Execute方法打开文件; 常量msoFileDialogSaveAs的值为2,表示保存文件对话框,允许选择一个文件并使用Execute方法保存当前文件; 常量msoFileDialogFilePicker的值为3,表示文件选取对...
fileDialogType MsoFileDialogType 类型,必需。文件对话框的类型。 MsoFileDialogType 可为以下 MsoFileDialogType 常量之一。 允许用户选择文件。 msoFileDialogFilePicker 允许用户选择一个文件夹。 msoFileDialogFolderPicker 允许用户打开文件。 msoFileDialogOpen 允许用户保存一个文件。 msoFileDialogSaveAs 【属性】 【◆实例...
一、Application.FileDialog 语法:expression.FileDialog (fileDialogType) MsoFileDialogType 可为下述常量之一: msoFileDialogFilePicker。 允许用户选择文件。 msoFileDialogFolderPicker。 允许用户选择文件夹。 msoFileDialogOpen。 允许用户打开文件。 msoFileDialogSaveAs。 允许用户保存文件。 其中msoFileDialogFolderPicker就是用...
```vba Sub SaveFile() Dim FileDialog As FileDialog Dim SavePath As Variant '创建一个保存文件对话框 Set FileDialog = Application.FileDialog(msoFileDialogSaveAs) '显示对话框并等待用户选择保存路径 If FileDialog.Show = -1 Then '获取用户选择的保存路径 SavePath = FileDialog.SelectedItems(1) '在这里可...
", vbCritical Me.txtPassWord.SetFocus Exit Sub End If strName = "产品.xlsx" '使用文件对话框取得另存为的文件名 With Application.FileDialog(2) 'msoFileDialogSaveAs .InitialFileName = strName If .Show Then strName = .SelectedItems(1) If Not strName Like "*....
MsgBox"请先输入密码!",vbCritical Me.txtPassWord.SetFocus Exit Sub EndIfstrName="产品.xlsx"'使用文件对话框取得另存为的文件名WithApplication.FileDialog(2)'msoFileDialogSaveAs.InitialFileName=strName If.ShowThenstrName=.SelectedItems(1)If Not strName Like"*.xlsx"ThenstrName=strName&".xlsx"Elsestr...
FileDialog(2) 'msoFileDialogSaveAs .InitialFileName = strName If .Show Then strName = .SelectedItems(1) If Not strName Like "*.xlsx" Then strName = strName & ".xlsx" Else strName = "" End If End With If strName = "" Then Exit Sub DoCmd.Hourglass True Set objExcel = ...
IfOutType =1Thenextension=".xls"Elseextension=".pdf"EndIf'Open the window to select the target folderDimresultAsString'弹出选择路径的窗口 startWithApplication.FileDialog(msoFileDialogSaveAs) .Title="Please select the target folder".InitialFileName="文件名"&extensionIf.Show = -1Thenresult= .Selected...
With Application.FileDialog(2) 'msoFileDialogSaveAs .InitialFileName = strName If .Show Then strName = .SelectedItems(1) If Not strName Like "*.xlsx" Then strName = strName & ".xlsx" Else strName = "" End If End With If strName = "" Then Exit Sub ...
VBA Save File Dialog, FileDialog(msoFileDialogSaveAs) Excel VBA, Save File Dialog, GetSaveAsFilename Sub Example3() Dim flag As Boolean Dim i As Integer Dim strPath As String strPath = Application.GetSaveAsFilename(FileFilter:= _ "Text Files (*.txt), *.txt", Title:="Save Location") ...