?
Solved

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

Posted on 2014-01-02
4
Medium Priority
?
1,316 Views
Last Modified: 2014-01-07
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
0
Comment
Question by:brothertruffle880
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 31

Accepted Solution

by:
Scott Helmers earned 2000 total points
ID: 39753017
How about a no-macro solution? What I've done was very quick and there may be better logic; plus, as currently implemented, it only allows two "views". But having said that, double-clicking the blue button toggles between the views using only shapesheet formula and no code.

Take note of the following in the page sheet:
-- User.ActiveLayer
-- Layers.1
-- Layers.2
and these cells in the shapesheet for the blue rectangle
-- User.ActiveLayerName
-- Fields.Value (note: I actually set this by use Insert>Field and typing the formula there)
-- EventDblClick

There isn't a single-click event in the shapesheet, so if you prefer the "Press for..." approach you may need to revert to a bit of VBA.
buttons-v2.vsd
0
 

Author Comment

by:brothertruffle880
ID: 39754321
Hi Scott:
Brilliant solution for a two-layer diagram.  Thanks.
0
 
LVL 11

Expert Comment

by:Visio_Guy
ID: 39761696
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!
0
 
LVL 11

Expert Comment

by:Visio_Guy
ID: 39761771
Regarding the history/other question I mentioned: I've posted a VBA solution (with Ctrl + M/Ctrl + T switching between layers) here:

http://www.experts-exchange.com/Microsoft/Applications/Microsoft_Visio/Q_28329331.html#a39761768
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The ability to add structure to Visio diagrams using containers, lists and callouts is one of my favorite features in Visio 2010. In this article I’ll describe a mashup of containers and lists that meet a real-world need. Prior to reading this ar…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question