0
votes

Is there any way to write a VBA macro in Outlook that forces a printout to a specific printer (even if it's not necessarily the default printer), similar to the Word

Application.ActivePrinter = "Printer Name"

option? I'd like to create a button that prints the current email and attachments to a specific printer (in this case a PDF printer, but I'm guessing it should be the same principle regardless), but can't seem to find a way to force which printer is used in the code.

2

2 Answers

1
votes

No, Outlook only exposes MailItem.PrintOut method.

You can save the message in the DOC or RTF format using MailItem.SaveAs, open it in Word, and use the Word Object Model to print it.

-1
votes

You can use this:

    Dim WshNetwork As Object
    Set WshNetwork = CreateObject("WScript.Network")
    WshNetwork.setDefaultPrinter "Microsoft Print to PDF"

Fill the string with your printer name.