View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Bernie Deitrick Bernie Deitrick is offline
external usenet poster
 
Posts: 5,441
Default 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