I am new at Excel VBA! I have the following code:
Dim wbCSV As Workbook
Dim fPath As String
Dim fCSV As String
fPath = "C:\Users\Tim\Store Data\"
fCSV = Dir(fPath & "FileName.txt")
Set wbCSV = Workbooks.OpenText Filename:=fPath & fCSV, _
DataType:=xlDelimited, Tab:=True, _
FieldInfo:=Array(Array(1, xlGeneralFormat), _
Array(2, xlDMYFormat), _
Array(3, xlGeneralFormat), _
Array(4, xlGeneralFormat), _
Array(5, xlGeneralFormat), _
Array(6, xlGeneralFormat))
There is a syntax error in Set wbCSV = Workbooks......
as it stays red in colour
Where is the error?
Many thanks
Dim wbCSV As Workbook
Dim fPath As String
Dim fCSV As String
fPath = "C:\Users\Tim\Store Data\"
fCSV = Dir(fPath & "FileName.txt")
Set wbCSV = Workbooks.OpenText Filename:=fPath & fCSV, _
DataType:=xlDelimited, Tab:=True, _
FieldInfo:=Array(Array(1, xlGeneralFormat), _
Array(2, xlDMYFormat), _
Array(3, xlGeneralFormat), _
Array(4, xlGeneralFormat), _
Array(5, xlGeneralFormat), _
Array(6, xlGeneralFormat))
There is a syntax error in Set wbCSV = Workbooks......
as it stays red in colour
Where is the error?
Many thanks
Last edited: