User selects multiple shapes, runs macro on all selected shapes

Started by Visisthebest, August 20, 2020, 05:13:49 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Visisthebest

The ability to add macros the user can run to the right-click menu on a shape is very useful, is there a way the user can select multiple shapes then get a right-click option to run this macro on all the selected shapes?

The macros on each shape are run with CALLTHIS with code in the stencil, so it is fine when the macros are run one after another on each selected shape (the Sub know which shape is calling it each time), and the order in which the macro is run on the shapes does not matter.

Or another practical way to achieve something similar with VBA.

Thank you for your help and advice!
Visio 2021 Professional

Yacine

Write the macro accordingly:
sub myMacro()
  for each shp in activewindow.selection
    do stuff
  next shp
Yacine

Visisthebest

Thank you Yacine yes that is a lot simpler than what I thought of as a solution!
Visio 2021 Professional