我在下面的代码中收到错误user defined type not defined
,这是我从目录中选择文件而创建的。此功能将在Ms Access
中用于
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel12Xml, "table", **selectFile**, True, "A1:N9000"
有人可以帮忙吗
Function selectFile()
Dim fd As FileDialog, fileName As String
On Error GoTo ErrorHandler
Set fd = Application.FileDialog(msoFileDialogFilePicker)
fd.AllowMultiSelect = False
If fd.Show = True Then
If fd.SelectedItems(1) <> vbNullString Then
fileName = fd.SelectedItems(1)
End If
Else
'Exit code if no file is selected
End
End If
'Return Selected FileName
selectFile = fileName
Set fd = Nothing
Exit Function
ErrorHandler:
Set fd = Nothing
MsgBox "Error " & Err & ": " & Error(Err)
End Function