![]() |
Batch Convert CSV to XLS
Hi Everyone!
Can anyone show me the code for a macro that will format a folder full of CSV files to XLS files automatically. Thanks Dave |
Batch Convert CSV to XLS
Dave,
Try the macro below. Just change the path to your folder.... HTH, Bernie MS Excel MVP Sub TransformCSVToXls() Application.DisplayAlerts = False myFile = ActiveWorkbook.Name myPath = "C:\Documents and Settings\DEITBE\My Documents\Excel\Delete These\" WorkFile = Dir(myPath & "*.CSV") Do While WorkFile < "" Application.StatusBar = "Now working on " & WorkFile Workbooks.Open FileName:=myPath & WorkFile MsgBox ActiveWorkbook.Name ActiveWorkbook.SaveAs FileName:=myPath & _ Left(ActiveWorkbook.Name, Len(ActiveWorkbook.Name) - 4), FileFormat:=xlNormal ActiveWorkbook.Close Windows(myFile).Activate WorkFile = Dir() Loop Application.StatusBar = False End Sub "Dave" wrote in message ... Hi Everyone! Can anyone show me the code for a macro that will format a folder full of CSV files to XLS files automatically. Thanks Dave |
All times are GMT +1. The time now is 07:06 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com