MrExcel Publishing
Your One Stop for Excel Tips & Solutions

saving multiple worksheets as seperate formatted text(space delimited )files

Posted by sydney naidoo on July 11, 2001 5:39 AM

hi i am new to excel
i have created a macro for a multiple worksheet workbook and also saved my first worksheet as a formatted text(space delimited )file .when i run the macro on the next worksheet i am prompted to use the text file that i initially created .i do not want to overwrite the first text file, i would like to create a prompt so that the user would be able to save the worksheet as a formatted text(space delimited)file in the same directory under a different file name the reason i require this is that i need to save about 50 text file so that it can be exported to a flat file processor and then imported into an sql7 database
thanks for your help

Posted by Ivan F Moala on July 11, 2001 10:17 AM

Use something along this line;

Sub Saveas_Text()
Dim Fs As String

Fs = Application.GetSaveAsFilename(fileFilter:="Text Files (*.Txt), *.Txt")
If Fs = "False" Then Exit Sub
ActiveWorkbook.SaveAs Fs

End Sub

Change as reuired or repost gor help