0
votes

I'm looking for a way to print a Word document programmatically with VBA in an Outlook macro. I think there may be two ways to accomplish this:

1) Use the Shell to print the document via command line switch with Word.

2) Use Outlook the print the document.

Is there a way to do this? I need to be able to specify the printer.

Thanks!!

2

2 Answers

1
votes

Ok. After some Google-ing, this is how it's done:

Dim WordObject As Object
Dim DocumentObject As Object

Set WordObject = CreateObject("Word.Application")
WordObject.Visible = True //Specifies if you want the actual window to appear

Set DocumentObject = WordObject.Documents.Open("File Name Here")
WordObject.ActivePrinter = "Printer Name Here"
WordObject.PrintOut (True) //Set to True to print in the background

Sources: http://msdn.microsoft.com/en-us/library/bb213458.aspx

0
votes

I think you should be able to use word object to invoke the printing functionality programatically. I know we did use excel classes programatically, so I am guessing you should be able to do word as well.