View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default How to save an entireworkbook to individual text files?

You could use a macro:

Option Explicit
Sub Testme02()

Dim Wks As Worksheet

For Each Wks In ActiveWorkbook.Worksheets
Wks.Copy 'to a new workbook
With ActiveSheet 'the new sheet in the new workbook
.Parent.SaveAs Filename:="C:\temp\" & .Name & ".txt", _
FileFormat:=xlTextWindows
.Parent.Close savechanges:=False
End With
Next Wks

End Sub

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

This also assumes that the worksheet names are valid OS names and that the
C:\Temp folder already exists.




stevieb wrote:

I regularily work with workbooks that contain well over 20 worksheets per
book. After working with the data I always have to save each 'sheet' as an
individual *.txt file. All the sheets are saved using the worksheet name.

Is there any way to automate this process, ie. save all worksheets to a
respective *.txt file. For example, 20 sheets in a book, will result in 20
seperate *.txt files.

Steve


--

Dave Peterson