WithEvents Keyword in Visio Automation

Let's return to Automation programming again. Now that you have seen how dependencies are established, you will want to use Automation interfaces to look for dependency triggers and take appropriate action based on that trigger.

You can define a class object to receive events. A class that receives events is sometimes called an event sink or a sink object. With the class definition, you can use the VBA keyword WithEvents to declare an object variable for the Visio object whose events you want to handle.

The next three examples will show three increasing levels of complexity in utilizing WithEvents.

The first example is a binding of the object defined WithEvents within the document module. This binding keeps ...

Get Professional Development with Visio® 2000 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.