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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.