Solved

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

Posted on 2014-01-02
4
1,217 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
Comment Utility
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
Comment Utility
Hi Scott:
Brilliant solution for a two-layer diagram.  Thanks.
0
 
LVL 11

Expert Comment

by:Visio_Guy
Comment Utility
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
Comment Utility
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
This is pretty cool.  The purpose of this VB Script is to help you document where JAR (Java ARchive) files and specifically java class files are located so that you can address issues seen with a client or that you can speak intelligently with a dev…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

771 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

10 Experts available now in Live!

Get 1:1 Help Now