[英]opening a csv with Excel VBA
我正在嘗試使用此代碼打開一個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”行,但我將路徑名作為字符串輸入
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.