LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Save as txt-file macro


Hi everyone,

I tried to save my xls-sheets to txt-files with a following macro:

Sub SaveFiles()
Dim sh As Worksheet
For Each sh In ActiveWorkbook.Worksheets
' copy the sheet to its own workbook
sh.Copy
ActiveWorkbook.SaveAs "C:\Temp\" & sh.Name & ".txt", _
FileFormat:=xlTextWindows
ActiveWorkbook.Close SaveChanges:=False
Next
End Sub

Everything is fine except one thing. There comes some extra tabs to th
end of some lines in my txt-files. What is the best way to avoid thos
empty spaces?
Is it possible to make some kind of loop to my macro? Or is there a
existing "command" (member) in some class?

I really appreciate any of your tips!

-Beginner81

--
Beginner8
-----------------------------------------------------------------------
Beginner81's Profile: http://www.excelforum.com/member.php...fo&userid=2538
View this thread: http://www.excelforum.com/showthread.php?threadid=38862

 
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
2007 Macro to Open File, Delete Contents, Save New File Flintstone[_2_] Excel Discussion (Misc queries) 2 February 1st 10 11:25 PM
Macro Save File (Unique file name) SJC Excel Worksheet Functions 5 October 27th 05 10:09 PM
ASP: Open Excel File with Macro, Allow Macro to run, and then save delgados129 Excel Programming 0 March 10th 05 09:35 PM
Macro to insert values from a file and save another sheet as a .txt file Frank[_16_] Excel Programming 2 August 28th 03 01:07 AM
Automate open file, update links, run macro, close and save file Geoff[_7_] Excel Programming 2 August 26th 03 10:13 PM


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