View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Beginner81 Beginner81 is offline
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