#1   Report Post  
nc
 
Posts: n/a
Default Convert .csv files

How can I use macro rename the sheet in the .csv files in a folder to
"Sheet1" and convert them to .xls files?
  #2   Report Post  
Anirudh
 
Posts: n/a
Default

Hi nc,

just open the file and use save as 'file name' and in save type 'microsoft
excel workbook'

anirudh


"nc" wrote:

How can I use macro rename the sheet in the .csv files in a folder to
"Sheet1" and convert them to .xls files?

  #3   Report Post  
nc
 
Posts: n/a
Default

Anirudh

I am not being funny, I meant macro???!!!. Because I have about 70 odd files.


"Anirudh" wrote:

Hi nc,

just open the file and use save as 'file name' and in save type 'microsoft
excel workbook'

anirudh


"nc" wrote:

How can I use macro rename the sheet in the .csv files in a folder to
"Sheet1" and convert them to .xls files?

  #4   Report Post  
Dave Peterson
 
Posts: n/a
Default

Since you posted in .misc, you're requirement of a macro solution for multiple
files wasn't immediately evident--well, not to me or anirudh.

But you could try this one:

Option Explicit
Sub testme()

Dim myFileNames As Variant
Dim fCtr As Long
Dim wks As Worksheet
Dim newFileName As String

myFileNames = Application.GetOpenFilename _
(filefilter:="Comma Separated Values, *.csv", MultiSelect:=True)

If IsArray(myFileNames) = False Then
'user hit cancel
Exit Sub
End If

For fCtr = LBound(myFileNames) To UBound(myFileNames)
Set wks = Workbooks.Open(Filename:=myFileNames(fCtr)).Worksh eets(1)
wks.Name = "Sheet1"
newFileName _
= Left(myFileNames(fCtr), Len(myFileNames(fCtr)) - 4) & ".xls"
With wks.Parent
Application.DisplayAlerts = False
.SaveAs Filename:=newFileName, FileFormat:=xlWorkbookNormal
Application.DisplayAlerts = True
.Close savechanges:=False
End With
Next fCtr

End Sub

Just click & ctrl-click on as many as you want to convert (or click the top one
and shift-click the bottom one to select all in between).

nc wrote:

Anirudh

I am not being funny, I meant macro???!!!. Because I have about 70 odd files.

"Anirudh" wrote:

Hi nc,

just open the file and use save as 'file name' and in save type 'microsoft
excel workbook'

anirudh


"nc" wrote:

How can I use macro rename the sheet in the .csv files in a folder to
"Sheet1" and convert them to .xls files?


--

Dave Peterson
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
Convert xls files Allen Excel Discussion (Misc queries) 1 June 28th 05 04:49 PM
Convert multiple XLS files to TXT finao Excel Discussion (Misc queries) 2 June 8th 05 03:14 PM
password protect .csv files CyberTaz Excel Discussion (Misc queries) 0 June 1st 05 12:12 AM
Errors when opening .csv files Brandan Lloyd Excel Discussion (Misc queries) 0 February 4th 05 02:12 PM
Must convert 500+ xls files to txt (tsv) KKramsch Excel Discussion (Misc queries) 1 January 5th 05 05:53 PM


All times are GMT +1. The time now is 10:57 AM.

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

About Us

"It's about Microsoft Excel"