Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default save sheet as "sheetname.txt"

Hello,
I have a file that contains multiple sheets. I'd like to be able to save
sheets from 5 to 10 as individual files in the .txt format with the name of
the sheets.

thank you
Igor
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default save sheet as "sheetname.txt"

for i = 5 to 10
worksheets(i).copy
Activeworkbook.SaveAs activesheet.Name & ".xls"
Activeworkbook.Close SaveChanges:=False
Next

--
Regards,
Tom Ogilvy

"igorek" wrote in message
...
Hello,
I have a file that contains multiple sheets. I'd like to be able to save
sheets from 5 to 10 as individual files in the .txt format with the name

of
the sheets.

thank you
Igor



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default save sheet as "sheetname.txt"

Tom,

While your code does save file as .txt, it does not actually ask Excel for
any specific txt format (text delimited or OS/2 Mac).
Is there a way to specify it?

Thank you
Igor
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default save sheet as "sheetname.txt"

Sorry, I missed the .txt in your post. (bad eyes).

for i = 5 to 10
worksheets(i).copy
Activeworkbook.SaveAs activesheet.Name & ".txt" FileFormat:=xlText
Activeworkbook.Close SaveChanges:=False
Next

also xlCSV and others - see excel vba help on FileFormat

--
Regards,
Tom Ogilvy


"igorek" wrote in message
...
Tom,

While your code does save file as .txt, it does not actually ask Excel for
any specific txt format (text delimited or OS/2 Mac).
Is there a way to specify it?

Thank you
Igor



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
Selecting "Save As" adds "Copy of" to file name- MS Excel 2007 ronhansen Excel Discussion (Misc queries) 1 November 15th 09 09:33 PM
a Macro to "save as" filename from a cell on the sheet and then pr gugertmk Excel Discussion (Misc queries) 0 March 31st 09 12:32 AM
"CELL("FILENAME") NOT UPDATE AFTER "SAVE AS" ACTION yossie6 Excel Discussion (Misc queries) 1 June 16th 08 12:16 PM
"Save" and "Save As" options greyed out - "Save as Webpage" option Bill Excel Discussion (Misc queries) 0 January 16th 07 04:47 PM
Can I "Save As..." an Excel Sheet to an Access Table? John Bixtis Excel Programming 6 June 18th 04 02:59 PM


All times are GMT +1. The time now is 11:43 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"