Tip: How to run VBA in the stencil with a keyboard shortcut

Started by Visisthebest, January 11, 2021, 01:46:01 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Visisthebest

Best solution I could come up with:

1. Create a macro-enabled Visio template file to go along with my macro-enabled stencil
2. I call VBA subs in the stencil with CALLTHIS in the Action section of the shapesheet (no VBA project references needed, in my opinion these cause potential deployment misery)
3. I add macros to the template (in the macro editor you can assign shortcut keys in the UI)
4. My macros in the template call VBA subs in the stencil by triggering CALLTHIS calls in the action section on a shape:
5. Sample code for using CALLTHIS from VBA in a template:
vsoCell = vsoShape.CellsSRC(visSectionAction, 0, 3)
vsoCell.Trigger

This works well, not the prettiest solution but practical enough.
Visio 2021 Professional