【发布时间】:2015-02-07 16:58:31
【问题描述】:
我正在尝试弹出文件对话框,以便用户可以选择文件路径以在 VBA 中导出文件,但由于某种原因,它会在以下代码行中引发此错误。
错误:对象“_Application”的方法“FileDialog”失败
代码:longResult = Application.FileDialog(msoFileDialogFolderPicker).Show
所有代码:
If choice = 6 Then
Dim intResult As Long
Dim strPath As String
'the dialog is displayed to the user
longResult = Application.FileDialog(msoFileDialogFolderPicker).Show
'checks if user has cancled the dialog
If intResult <> 0 Then
'dispaly message box
Call MsgBox(Application.FileDialog(msoFileDialogFolderPicker _
).SelectedItems(1), vbInformation, "Selected Folder")
End If
Else
End
End If
我真的不确定如何解决这个问题。我检查了我的语法和所有内容。
【问题讨论】:
标签: ms-access vba ms-access-2010 openfiledialog