Export (0) Print
Expand All

How to: Programmatically Print Visio Documents

You can print a complete Microsoft Office Visio document or only a specific page.

For details about the print methods, see the VBA reference documentation for the Microsoft.Office.Interop.Visio.Document.Print method and Microsoft.Office.Interop.Visio.Page.Print method.

To print a complete document

  • Call the Microsoft.Office.Interop.Visio.Document.Print method of the Microsoft.Office.Interop.Visio.Document object that you want to print.

    The following code example prints the active document. To use this example, run the code from the ThisAddIn class in your project.

    this.Application.ActiveDocument.Print();
    

To print a page of a document

  • Call the Microsoft.Office.Interop.Visio.Pages.Print method of the Microsoft.Office.Interop.Visio.Pages object that you want to print.

    The following code example prints the first page of the active document. To use this example, run the code from the ThisAddIn class in your project.

    int pageIndex = 1;
    Visio.Pages visioDocPages = this.Application.ActiveDocument.Pages;
    if (pageIndex <= visioDocPages.Count)
        visioDocPages[pageIndex].Print();
    
Show:
© 2015 Microsoft