我正在尝试使用此代码打开一个 csv 文件,但它一直给我一个“错误 52 错误文件名或编号”
Sub ShowFileDialog()
Dim x As String
Dim FF1 As Integer
Dim dlgOpen As FileDialog
Set dlgOpen = Application.FileDialog( _
msoFileDialogFilePicker)
With dlgOpen
.Show
End With
x = CStr(dlgOpen.SelectedItems(1))
MsgBox x
Open x For Input As #FF1
Do While Not EOF(FF1)
Line Input #FF1, inputdata
Dim lineData() As String
lineData() = Split(inputdata, ",")
Loop
Close #FF1
End Sub
调试器突出显示 Open for X 行,但我将路径名作为字符串提供给它