Solved

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

Posted on 2014-01-02
4
1,223 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
  • 2
4 Comments
 
LVL 30

Accepted Solution

by:
Scott Helmers earned 500 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Book Review: Using Microsoft Visio 2010 by Chris Roth   Disclaimer: The author of Using Visio 2010 is a friend and fellow Visio MVP. Whether you’re new to Visio or are upgrading to Visio 2010 from a previous version, you will find a lot to like…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

920 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now