Author Topic: Tip: How to run VBA in the stencil with a keyboard shortcut  (Read 109 times)

0 Members and 1 Guest are viewing this topic.

Visisthebest

  • Sr. Member
  • ****
  • Posts: 279
Tip: How to run VBA in the stencil with a keyboard shortcut
« on: January 11, 2021, 08:46:01 AM »
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.