Understanding the Visio object model
An object model defines how the various objects and collections relate to each other, and their properties, methods, and events. Knowing how to navigate around it is essential for writing quick code in VBA, or more capable code for an add-in or add-on.
Starting with the Application object
The top-level object is the Visio Application
object itself. This object contains a collection of documents that are currently open.
Note
Actually, there is also the InvisibleApp
object, which a developer can use to interact with a diagram without the Visio application interface appearing on the screen.
Templates, drawings, and stencils are all types of Visio documents, although the user only sees stencils on the panels of shapes on the left of the drawing page. A drawing is usually created from a template document. However, a drawing can also be created from any existing drawing.
A drawing document consists of a collection of pages, each of which can contain a collection...