I am attempting open a csv file with this code and it keeps giving me an "error 52 bad file name or number"
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
The debugger is highlighting the Open for X line but I am feeding it the path name as a string
FF1 = FreeFilebefore opening.