Saving file to *.prn format
Your code worked as-is for me.
Any chance that testfile.prn is marked readonly (or that you have it open
somewhere else)?
What's the error message that you get?
JON JON wrote:
Hello NG,
Can someone explain why I can not make this piece of code to work and help
me correct it. The debugger always stop on the SaveAs command.
testfile.xls is just a tabulation of numbers formatted as text.
TIA.
Jon-jon
Sub Test_xls2prn()
Workbooks.Open Filename:="c:\testfile.xls", ReadOnly:=True
With ActiveWorkbook
.Sheets(1).Cells(1, 1).Select
Application.DisplayAlerts = False
.SaveAs Filename:="c:\testfile.prn", _
FileFormat:=xlTextPrinter, CreateBackup:=False
Application.DisplayAlerts = True
End With
ActiveWorkbook.Close True
Kill "c:\testfile.xls"
End Sub
--
Dave Peterson
|