.prn file in Excel


Posted by Darci on January 23, 2002 3:06 PM

I have a project that I am trying to solve for my boss, of which I have limited knowledge of.. so here goes. We would like to get xl to take individual columns and save them as a .prn file (This used to be done in Lotus, but with the DOS version of windows NT, it is not clear how to do this.. PLEASE help >>
I greatly appreciate any assistance..

Posted by Joe Was on January 23, 2002 3:26 PM

You just open the Save As form and select a .txt option from the botton pull-down box "Save As Type." JSW

Posted by Darci on January 23, 2002 6:38 PM

But how do you get it to go to the separate columns (of which we have numerous) and save each one as a different name, with a macro??

Posted by Joe Was on January 23, 2002 7:57 PM

This is the code to save a file with the column lable as the file name:

Sub SaveByCell()
Dim sFileName As String
'add sheet select code.
'Change column, or add select code
Columns("G:G").Select
Selection.Copy
'Add a new sheet just for the data in the column above.
Sheets.Add
'Paste the column data to the new sheet.
ActiveSheet.Paste
Range("A1").Select
'Use copied column lable for file name.
'Cell A1 has the new file name.
sFileName = Sheets("Sheet1").Range("A1")

'If Cell A1 is Blank do not save.
If sFileName = "" Then Exit Sub

'Save the column data as a file with the column lable as the files name.
'The Drive:\Path & the file name in cell A1.
ThisWorkbook.SaveAs "C:\MyFiles\Excel\Data\" & sFileName
End Sub


Try this. JSW



Posted by Darci on January 24, 2002 9:20 AM

JSW, one problem

Thanks, JSW but I am not able to get it to run, I have this code, with data ranging from rows 1 to 37, and the file name is in 1, then i have 10 columns. It pastes the first column fine, but how do I get it to go to the next column, and also, it never renamed the sheet name, they are kept as sheet2 and sheet3. Thanks again.
Darci


Private SubWorkbook()
Sub SaveByCell()

Dim sFileName As String
Columns("A:A").Select
Selection.Copy
Sheets.Add
ActiveSheet.Paste
Range("A1").Select
sFileName = Sheets("Sheet1").Range("A1")
If sFileName = "" Then Exit Sub

ThisWorkbook.SaveAs "N:\Darci\Projects\" & sprncode.xls

End Sub