Hi All,
I have a folder that receives many csv file extracts which I need to convert into xlsx files instead.
I have the code below which I found on one site, but I receive an error at line 3
Error:
I haven't been able to test it yet, so I actually have no idea if this is even on the correct path or not...
Thank you in advance
I have a folder that receives many csv file extracts which I need to convert into xlsx files instead.
I have the code below which I found on one site, but I receive an error at line 3
Code:
Dim CSVfolder As String
Error:
Expected end of statement
I haven't been able to test it yet, so I actually have no idea if this is even on the correct path or not...
Code:
Sub CSVtoXls()
Dim CSVfolder As String
Dim XlsFolder As String
Dim fname As String
Dim wBook As Workbook
CSVfolder = "C:\Users\Desktop\3rd Party\Work Folder\"
XlsFolder = "C:\Users\Desktop\3rd Party\Work Folder\xlsx\"
fname = Dir(CSVfolder & "*.csv")
Do While fname <> ""
Set wBook = Workbooks.Open(CSVfolder & fname, Format:=6, Delimiter:=",")
wBook.SaveAs XlsFolder & Replace(fname, ".csv", ".xls")
wBook.Close False
fname = Dir
Loop
End Sub
Thank you in advance