Link to home
Start Free TrialLog in
Avatar of brothertruffle880
brothertruffle880Flag for United States of America

asked on

Visio VBA - My macro assignment to multi-layer buttons isn't working

I have a Visio sheet with two views (technical and management).
I have two  buttons in the upper right corner that somehow aren't working 100% of the time.
I want the "PRESS TO VIEW TECHNICAL" button to be visible when I'm in the manager view.
I want the "PRESS TO VIEW SUMMARY" button to be visible when I'm in the technical view.  Both buttons are in the same X/Y position.

I assigned the technical button to the management layer.
I assigned the management button to the technical layer.

Somehow they don't seem to work consistently.
Currently I press:
- CTRL + t for technical view.
- CTRL + m for manager view.
I want to assign those two macros to two buttons.
Please tell me what I did wrong.  And how to fix it.

I have attached the file.
buttons.vsd
ASKER CERTIFIED SOLUTION
Avatar of Scott Helmers
Scott Helmers
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of brothertruffle880

ASKER

Hi Scott:
Brilliant solution for a two-layer diagram.  Thanks.
Hi BT, Scott,

I think there's some background to this thread that started with another question from BT a few days ago.

He was having a problem with layers on multiple pages. The layers were created in different order, and had different indices, so a recorded macro didn't work properly on Page-2.

Scott's solution is very cool, but is also susceptible to this layer-index problem as well. However, you might not need the extra pages, now that this is working!
Regarding the history/other question I mentioned: I've posted a VBA solution (with Ctrl + M/Ctrl + T switching between layers) here:

https://www.experts-exchange.com/questions/28329331/Visio-VBA-Switching-Layers-with-a-macro.html?anchorAnswerId=39761768#a39761768