|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer|
The information in this topic applies only to the specified Visual Studio Tools for Office projects and versions of Microsoft Office.
Microsoft Office version
For more information, see Features Available by Application and Project Type.
Visual Studio Tools for Office provides project templates you can use to create application-level add-ins for Microsoft Office Visio. You can use add-ins to automate Visio, extend Visio features, or customize the Visio user interface (UI).
For more information about application-level add-ins, see Getting Started Programming Application-Level Add-Ins and Architecture of Application-Level Add-Ins.
If you are new to programming with Microsoft Office, see Getting Started (Visual Studio Tools for Office).
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.
You can view step-by-step procedures and code examples for using the object model of Microsoft Office Visio to work with documents and shapes in Visual Studio Tools for Office projects in Working with Visio Documents and Working with Visio Shapes.
To access the Visio object model from a Visual Studio Tools for Office add-in, use the Application field of the ThisAddIn class in your project. The Application field returns a Microsoft.Office.Interop.Visio.Application object that represents the current instance of Visio. For more information, see Programming Application-Level Add-Ins.
When you call into the Visio object model, you use types that are provided in the primary interop assembly for Visio. The primary interop assembly acts as a bridge between the managed code in the Visual Studio Tools for Office add-in and the COM object model in Visio. All types in the Visio primary interop assembly are defined in the Microsoft.Office.Interop.Visio namespace. For more information about primary interop assemblies, see Office Solutions Development Overview and Office Primary Interop Assemblies.
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.
The Visio UI has the following customization options.
For more information
Add custom toolbars and toolbar items.
Add menus and menu items.
For information about customizing the UI of Visio, see the VBA reference documentation for the Visio.UIObject class.