Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm trying to adapt code from http://www.cpearson.com/excel/imptext.htm to
export 150 spreadheets of data to separate text files. It seems to work as long as I type the name of each text file into the save as box. I was hoping someone could show me how to alter the code so that the name of the text file could set automatically based on either the contents of cell A1 or the sheet name of the sheet being exported. Here's what I have so far: Public Sub DoTheExport() Dim FName As Variant Dim Sep As String Dim m As Integer For m = 1 To Sheets.Count ChDir "C:\Documents and Settings\TJ\Desktop\QualDatTEXT" FName = Sheets(m).Range("A1") 'I know this is wrong-I don't know how to fix it FName = Application.GetSaveAsFilename() If FName = False Then MsgBox "You didn't select a file" Exit Sub End If Sep = "," ExportToTextFile CStr(FName), Sep, False Next m End Sub -- tj |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
export sheets to multiple new files | Excel Discussion (Misc queries) | |||
export multiple sheets to multiple excel files | Excel Discussion (Misc queries) | |||
Macro that stores all sheets as tab-delimited text files | Excel Discussion (Misc queries) | |||
Export sheets as JPEG files through a dialog box (Problems) | Excel Programming | |||
Copy text files into multiple sheets of 1 workbook | Excel Programming |