Save as prn in VBA

markh1182

New Member
Joined
Apr 25, 2006
Messages
48
Hi, As part of some code I save a spreadsheet as a prn (formatted text (space delimited)) file, however when I open that file from the folder it is corrupt and not in a recognisable format. The code is:
Code:
    Set xlbook = ActiveWorkbook
    Sheets(1).Select
    Application.ActiveWorkbook.SaveAs ("H:\94\Users\MIL\_Hincma\precost1.prn")
    Application.ActiveWorkbook.Close

Do I have to do something else to save it as this file type and keep it usable?
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Hi Mark,

I just tried your code and it worked fine for me?

Could it be that it has something to do with what is in the sheet you are trying to save? Try a simple sheet and see if that corrupts.

Also what version of Excel are you using? I'm using Excel Office 2003, SP2.

Boz
 
Upvote 0
Thanks for your reply but I have managed to solve it now by changing my saveas line to:

Code:
ActiveWorkbook.SaveAs Filename:="H:\94\Users\MIL\_Hincma\precost3.prn", FileFormat:=xlText
 
Upvote 0

Forum statistics

Threads
1,214,805
Messages
6,121,664
Members
449,045
Latest member
Marcus05

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top