Avatar of brothertruffle880
brothertruffle880
Flag 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
Microsoft VisioVB ScriptVisual Basic.NET

Avatar of undefined
Last Comment
Chris Roth

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Scott Helmers

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
brothertruffle880

ASKER
Hi Scott:
Brilliant solution for a two-layer diagram.  Thanks.
Chris Roth

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!
Chris Roth

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
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck