0
我試圖用這個代碼打開一個CSV文件,它不斷給我一個「錯誤52錯誤的文件名或號碼」打開一個csv用Excel VBA
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
調試器是突出開放的X線但我餵養它的路徑名字符串
您從未將FF1設置爲文件編號。開幕之前'FF1 = FreeFile'。 – Jacob