Chapter 15, Programming Visio with VBA

Chapter 15, Programming Visio with VBA

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

Any programming language that supports Automation can be used to write programs that access Microsoft® Visio® objects, get and set properties, invoke methods, and receive events. Visio provides a standard integrated development environment (IDE) for convenient development of Microsoft® Visual Basic® for Applications (VBA) projects.

If your solution will use Automation to control shapes and drawings, read or write data to or from external sources (such as a database), or interact with other applications, you can write VBA code in Visio to accomplish these tasks. The Visio VBA IDE is consistent with the IDE in all VBA-enabled applications, for example, Microsoft® Office or Office XP applications. If you've used VBA in any of these applications, the Visio environment will be familiar to you.

This chapter provides a brief overview of some common tasks using VBA in Visio. For complete details about using the VBA development environment and writing VBA code, see the Microsoft Visual Basic Help.

In this chapter…

Using the Visual Basic Editor

Creating a VBA Project

Using the Visio Type Library

Using the Global and ThisDocument Objects

Running VBA Code from Visio

Handling Errors

Managing a VBA Project