Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,388
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.misc
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
batch file camilia Excel Discussion (Misc queries) 0 February 1st 07 01:59 PM
batch delete jason2444 Excel Discussion (Misc queries) 1 September 21st 06 04:01 AM
batch printing without VBA krikri Excel Discussion (Misc queries) 2 February 9th 06 02:24 PM
Batch change Tester Excel Discussion (Misc queries) 0 November 9th 05 02:32 PM
How batch calculations? ZPXY Excel Worksheet Functions 2 September 21st 05 07:17 AM


All times are GMT +1. The time now is 11:41 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"