问题
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.
Thanks.
回答1:
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.
回答2:
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.
来源:https://stackoverflow.com/questions/26474072/use-vba-to-tell-outlook-to-print-to-a-specific-printer