Tom’s Tutorials for Excel: Print a Word document from Excel

Tom’s Tips for Excel: Print a Word document from Excel

Here is the Tuesday blog length post from Tom Urtis. This one is so handy!

Sub PrintWordDoc()
'Declare object variables.
Dim WdApp As Object, wddoc As Object
'Open Word
Set WdApp = CreateObject("Word.Application")
'Open the Word document to be printed.
Set wddoc = WdApp.Documents.Open(Filename:="C:\Your\File\Path\YourWordDoc.docx")
'Print the entire Worddocument.
wddoc.PrintOut
'Give the print job 5 seconds to complete before closing Word.
Application.Wait Now + TimeSerial(0, 0, 5)
'Close the Word document, no need to save changes.
wddoc.Close savechanges:=False
'Quit the Word application.
WdApp.Quit
'Set the Object variables to Nothing to release system memory.
Set wddoc = Nothing
Set WdApp = Nothing
End Sub

Share Button
Posted in Tom's Tutorials for Excel
Tags: , , , , , , , , , , , , ,

Leave a Reply

Your email address will not be published.

*