Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
sedamfo
 
Posts: n/a
Default save excel file from a table delimited file (.txt) using macros

Hi to you all

I have files in tab delimited file and I want to save them as excel
files.
Since I'll have to do this for many files, I want to use a macro
I used the record macro function and got a code that works, but the
problem is that it always saves the same name - and what I want is to
the file to be saved using the same file name as the file is active,
something like ActiveWorkbook in line 2? (it doesn't work but it would
be something like that...)

ActiveWorkbook.SaveAs FileName:= _
"Macintosh HD:Myfile.xls" _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False



I have looked for a while in the postings archives, but couldn't find
anything. there's a lot of stuff so I could have easily have missed it.
thanks for your help and patience

  #2   Report Post  
galimi
 
Posts: n/a
Default

Try executing the following code in a module

Sub saveTab()
Dim wb As Workbook

For Each wb In Workbooks
intCounter = intCounter + 1
wb.SaveAs wb.Name & " Tab Delimited Number " & intCounter & ".xls",
xlFormat

Next

End Sub

http://HelpExcel.com
"sedamfo" wrote:

Hi to you all

I have files in tab delimited file and I want to save them as excel
files.
Since I'll have to do this for many files, I want to use a macro
I used the record macro function and got a code that works, but the
problem is that it always saves the same name - and what I want is to
the file to be saved using the same file name as the file is active,
something like ActiveWorkbook in line 2? (it doesn't work but it would
be something like that...)

ActiveWorkbook.SaveAs FileName:= _
"Macintosh HD:Myfile.xls" _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False



I have looked for a while in the postings archives, but couldn't find
anything. there's a lot of stuff so I could have easily have missed it.
thanks for your help and patience


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
Can't save new excel file twm7766 Excel Discussion (Misc queries) 3 February 2nd 05 12:56 AM
Excel Exits on File Close with Outlook Erin Searfoss Excel Discussion (Misc queries) 1 January 16th 05 10:43 PM
save an Excel worksheet as a comma delimited file? Trophy Man Excel Discussion (Misc queries) 2 January 8th 05 04:11 AM
Excel 2000 file when opened in Excel 2003 generates errors? Doug Excel Discussion (Misc queries) 13 December 25th 04 11:20 PM
double click a xls file and start Excel but without the file Danyi, Attila Excel Discussion (Misc queries) 2 December 22nd 04 03:19 PM


All times are GMT +1. The time now is 01:55 PM.

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"