Microsoft Print to PDF using VBA Code

Anonymous
2023-08-22T15:25:18+00:00

how to write VBA Code for Ensuring when print is done, it is done automatically using Microsoft Print to PDF using VBA Code in the macro called as "RUN PRINT"

Please share the code

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes
Answer accepted by question author
  1. Anonymous
    2023-08-26T18:28:07+00:00

    Hello

    Here is a VBA code to set the default printer to Microsoft Print to PDF:

    CreateObject("WScript.Network"). SetDefaultPrinter "Microsoft Print to PDF"

    Kind regards

    5 people found this answer helpful.
    0 comments No comments
Answer accepted by question author
  1. Anonymous
    2023-08-27T07:53:13+00:00

    Hello,

    If you run this macro, it will change the default printer to Microsoft Print to PDF, regardless of the current default printer.

    Kind Regards

    2 people found this answer helpful.
    0 comments No comments

14 additional answers

Sort by: Most helpful
  1. Anonymous
    2023-08-26T12:34:47+00:00

    Set the new default printer Application.ActivePrinter = "Printer Name Here"

    Using above code, how to set default printer to MS Print to PDF here?

    0 comments No comments
  2. Anonymous
    2023-08-27T02:16:18+00:00

    Hi Sir,

    I have entered above code in my VBA macro. It is working now.

    But I want to ask you one query:

    IF suppose, my printer selected by default in control Panel is ABC Company Printer, after running this macro, whether it will force the change from ABC Printer to MS Print to PDF?

    Please advice.

    0 comments No comments
  3. Anonymous
    2023-08-27T08:26:19+00:00

    Hi, OK thanks Sir.

    0 comments No comments