?
Solved

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

Posted on 2014-01-02
4
Medium Priority
?
1,279 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses
Course of the Month8 days, 8 hours left to enroll

764 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