Convert Word to prn

W

Word-to-prn

Hello all,

I need to convert Doc(word) file to Prn file through VBA or through any
programming language. Could you please advise me how to convert doc to
prn(or)ps without manual interaction.

I tried to convert "doc to prn" through visual basic. I copied the code. If
i run the code the dialog window appers for saving the .prn file. Is it
possible to control that dialog window(save as) via code(without manual
interaction). (Or) Is there any third party tool available for this.

Code:
Dim WordObj As Word.Application
Dim Doc As Word.Document
Set WordObj = New Word.Application
WordObj.DisplayAlerts = 0
Set Doc = WordObj.Documents.Open("C:\1.doc")
WordObj.PrintOut Background:=False
Doc.Saved = True
WordObj.Quit
Set WordObj = Nothing

Thanks in advance
 
S

Steve Rindsberg

Word-to-prn said:
Hello all,

I need to convert Doc(word) file to Prn file through VBA or through any
programming language. Could you please advise me how to convert doc to
prn(or)ps without manual interaction.

PRN isn't a file format as such. It's just the extension Windows gives by
default to the files that result when you print to disk using any printer
driver.


I tried to convert "doc to prn" through visual basic. I copied the code. If
i run the code the dialog window appers for saving the .prn file. Is it
possible to control that dialog window(save as) via code(without manual
interaction). (Or) Is there any third party tool available for this.

Code:
Dim WordObj As Word.Application
Dim Doc As Word.Document
Set WordObj = New Word.Application
WordObj.DisplayAlerts = 0
Set Doc = WordObj.Documents.Open("C:\1.doc")
WordObj.PrintOut Background:=False

Instead of the above, try
WordObj.ActivePrinter = "hp LaserJet 1320 PS"
WordObj.ApplicationPrintOut FileName:="", _
Range:=wdPrintAllDocument, _
Item:= wdPrintDocumentContent, _
Copies:=1, _
Pages:="", _
PageType:=wdPrintAllPages, _
ManualDuplexPrint:=False, _
Collate:=False, _
Background:=False, _
PrintToFile:=True, _
PrintZoomColumn:=0, _
PrintZoomRow:=0, _
PrintZoomPaperWidth:=0, _
PrintZoomPaperHeight:=0, _
OutputFileName:="c:\temp\whoopee.prn", _
Append:=False
End Sub

' Change OutputFileName and ActivePrinter to suit your needs.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top