PDA

View Full Version : [SOLVED:] Batch Print .doc to .prn VBA



Swizylstik
05-24-2021, 01:09 PM
I routinely need to print .doc files to .prn (which I then rename as .txt files) and I'm looking for a way to batch print.

For the types of files I work on, it's necessary to print to .prn and rename as .txt as printing to .txt or saving directly to .txt messes up my formatting.

Does anyone have a VBA suggestion?

Thank you!

Logit
05-24-2021, 02:49 PM
I am not familiar with "printing" a DOC file to PRN. Is that the same as saving a DOC file to the PRN format ?

Also ... does the following resource help in part, with the process ?
https://www.dell.com/support/kbdoc/en-us/000108643/how-to-generate-a-prn-file-from-word-excel-and-pdf-reader-applications

Swizylstik
05-24-2021, 04:53 PM
I am not familiar with "printing" a DOC file to PRN. Is that the same as saving a DOC file to the PRN format ?

Also ... does the following resource help in part, with the process ?
https://www.dell.com/support/kbdoc/en-us/000108643/how-to-generate-a-prn-file-from-word-excel-and-pdf-reader-applications


Printing to .prn is different than saving a .doc to .prn. When you print to .prn you use the generic/text printer which strips some formatting from the .doc, but leaves others. Your result will be different also from saving to .txt.

macropod
05-24-2021, 06:31 PM
For a single document, that's as simple as:

Sub Demo()
With ActiveDocument
.PrintOut PrintToFile:=True, OutputFileName:=Split(.FullName, ".doc")(0) & ".txt"
End With
End Sub
You need to clarify, though, how the members of a batch print would be identified (e.g. all open documents, all documents in a selected/specified folder, documents selected from a pick list, other).

gmayor
05-25-2021, 01:24 AM
https://www.gmayor.com/Batch_Print.htm will allow you to select the generic/text printer and 'print' to a folder of your choice.

Swizylstik
05-25-2021, 12:10 PM
Thank you!