• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Open CSV file and do delimited and save the file as .xlsx or .xls

K Raghavender rao

New Member
Hi,

I have some 1000 "CSV" files in one folder i want to open each file do delimited with "|" and after then save the file in another folder in ".xlsx" format.

Can some one please provide the VBA Code so that it can do my job easily.

Thanks in advance for helping in me.

K.Raghavender rao
 
Check This...

Code:
Sub csvTOxl()
 Dim CSVF As String
 Dim XLF As String
 Dim fname As String
 Dim wb As Workbook

 CSVF = "C:\ABC\" 'Change
 XLF = "C:\XL\"

 fname = Dir(CSVF & "*.csv")

 Do While fname <> ""
    Set wb = Workbooks.Open(CSVF & fname, Format:=6, Delimiter:="|")
    wb.SaveAs XLF & wb.Name, ThisWorkbook.FileFormat
    wb.Close False
 fname = Dir
 Loop

End Sub
 
Back
Top