Ask Learn
Preview
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Many developers are used to calling VSL or EXE add-ons from ShapeSheet cells. Many of us, however, have fallen in love with C# and VB.NET. VSL's are primarily written using VC++. You can write EXE add-ons in managed code, but you want a solution that runs in-process. So what's a Visio developer gotta do? The answer is to create a COM add-in. The puzzling question that arises when attempting this approach is, "how do you 'call' a COM add-in from the ShapeSheet?"
As you know, COM add-ins are usually loaded on startup with Visio. Because they are already loaded and running, you don't really "call" COM add-ins as we do with VSL or EXE add-ons. Instead, from the ShapeSheet cell you would raise an event and handle it in your COM add-in. Visio provides the MarkerEvent event that allows you to encode application specific information in its ContextString parameter. By convention, the data that developers pass using the ContextString parameter look a lot like command line switches (e.g. "/solution=MyAddIn /cmd=100"). When the event is raised, your COM add-in would handle it by parsing the context string, determining if the marker event belongs to you, and by executing the specified command. The MarkerEvent event is the essential device to "call" commands in your COM add-in.
There are three ways of raising a marker event from a ShapeSheet cell: by using the Application.QueueMarkerEvent method, by running the QueueMarkerEvent add-on (using the RUNADDONWARGS ShapeSheet function), or by using the new QUEUEMARKEREVENT ShapeSheet function. The first way was used in a VBA procedure in conjunction with the CALLTHIS ShapeSheet function (yuck!). The second approach was introduced in Visio 2002 SR1 and is still highly useful when combined with the Persistent Events tool. And finally, Visio 2003 provides the QUEUEMARKEREVENT ShapeSheet function. Needless to say, you should raise marker events from the ShapeSheet using this function.
Here’s a recap:
-Chris
This posting is provided "AS IS" with no warranties, and confers no rights
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign in