Programmatically call microft print to pdf and dynamically pass filepath and filename information

Martin, Brian 1 Reputation point
2022-11-29T20:19:04.85+00:00

I have a set of documents that I would like to save as pdf files and place in different network folders. Is there a way to do this programmatically using vba or C#, etc

Office Visual Basic for Applications
Office Visual Basic for Applications
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Visual Basic for Applications: An implementation of Visual Basic that is built into Microsoft products.
1,496 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Castorix31 87,066 Reputation points
    2022-11-29T20:33:36.21+00:00

    Is there a way to do this programmatically using vba or C#, etc

    You can use PrintDocument.PrinterSettings, like :

    PrintDocument.PrinterSettings.PrinterName = "Microsoft Print to PDF";
    PrintDocument.PrinterSettings.PrintToFile = true;
    PrintDocument.PrinterSettings.PrintFileName = "pdf_filename";

    1 person found this answer helpful.
    0 comments No comments

  2. winironteam 26 Reputation points
    2024-07-31T04:43:06.7933333+00:00

    You can programmatically save documents as PDFs and place them in network folders using IronPDF in C#. Learn more here.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.