Applies to: Visual Studio Visual Studio for Mac
This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here
Visual Studio provides project templates you can use to create VSTO Add-ins for Microsoft Office Visio. You can use VSTO Add-ins to automate Visio, extend Visio features, or customize the Visio user interface (UI).
For more information about VSTO Add-ins, see Get started programming VSTO Add-ins and Architecture of VSTO Add-ins. If you are new to programming with Microsoft Office, see Get started (Office development in Visual Studio).
Applies to: The information in this topic applies to VSTO Add-in projects for Visio 2010. For more information, see Features Available by Office Application and Project Type.
Automate Visio by using the Visio object model
The Visio object model exposes many classes that you can use to automate Visio to create diagrams for organizational charts, flowcharts, project timelines, network diagrams, office spaces, and more. The API enables you to write code to accomplish common tasks:
Construct and position shapes and text in diagrams.
Manage shape behavior based on business logic and user input.
Control diagram visualization such as panning and zooming.
Customize the application UI.
Import external data into Visio, link it to shapes, and display it graphically on a page.
To access the Visio object model from a VSTO Add-in, use the
Applicationfield of the
ThisAddInclass in your project. The
Applicationfield returns a
Microsoft.Office.Interop.Visio.Applicationobject that represents the current instance of Visio. For more information, see Program VSTO Add-ins.
When you call into the Visio object model, you use types that are provided in the primary interop assembly (PIA) for Visio. The PIA acts as a bridge between the managed code in the VSTO Add-in and the COM object model in Visio. All types in the Visio PIA are defined in the
Microsoft.Office.Interop.Visionamespace. For more information about primary interop assemblies, see Office solutions development overview (VSTO) and Office primary interop assemblies.
Visio object model overview
You can find an overview of the Visio object model at Visio object model overview, which includes links to the Visio object model reference and the SDKs.
Customize the user interface of Visio
The Visio UI has the following customization options.
|Task||For more information|
|Customize the ribbon.||Ribbon Overview|
For information about customizing the UI of Visio, see the VBA reference documentation for the Visio.UIObject class.
- Get started programming VSTO Add-ins
- Office solutions development overview (VSTO)
- Architecture of VSTO Add-ins
- How to: Create Office projects in Visual Studio
- Program VSTO Add-ins
- Write code in Office solutions
- Office primary interop assemblies
- Office UI customization
- Visio object model overview
- Visio 2010 in Office development