Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Macro that stores all sheets as tab-delimited text files
Hi!
I'm trying to write an macro that converts one single xls-file to multiple text file (tab delimited) with filenames corrsponding to the names of the sheets. How to do that? I recorded my actions: Sub GemAsTxt() ActiveWorkbook.SaveAs Filename:= _ "H:\Develop\work\TestData\Testmodel.txt", FileFormat:= _ xlText, CreateBackup:=False End Sub But what I need is: Sub GemAsTxt() for all sheets: ActiveWorkbook.SaveAs Filename:= _ "<directoryOfCurrentExcelFile\<excelfileWithoutFi leType\<sheetname", FileFormat:= _ xlText, CreateBackup:=False End Sub |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Macro that stores all sheets as tab-delimited text files
Doesn't work unless a directory matching the name of the workbook (without
the .xls) already exists Sub SaveEm() Dim strPath As String Dim ws As Worksheet With ActiveWorkbook strPath = .Path & "\" & WorksheetFunction.Substitute(.Name, ".xls", "\") For Each ws In .Worksheets ws.SaveAs strPath & ws.Name & ".txt", xlTextWindows Next End With End Sub " wrote: Hi! I'm trying to write an macro that converts one single xls-file to multiple text file (tab delimited) with filenames corrsponding to the names of the sheets. How to do that? I recorded my actions: Sub GemAsTxt() ActiveWorkbook.SaveAs Filename:= _ "H:\Develop\work\TestData\Testmodel.txt", FileFormat:= _ xlText, CreateBackup:=False End Sub But what I need is: Sub GemAsTxt() for all sheets: ActiveWorkbook.SaveAs Filename:= _ "<directoryOfCurrentExcelFile\<excelfileWithoutFi leType\<sheetname", FileFormat:= _ xlText, CreateBackup:=False End Sub |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Macro that stores all sheets as tab-delimited text files
Thank you
I'll try it (-: /Bjoern |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Stop excel from dropping the 0 in the beginning of a number? | Setting up and Configuration of Excel | |||
How can I convert tab delimited files to pipe delimited? | Excel Discussion (Misc queries) | |||
Insert text in a cell with a macro | Excel Discussion (Misc queries) | |||
multiple text files URGENT | Excel Discussion (Misc queries) | |||
importing multiple text files??? | Excel Discussion (Misc queries) |