Solved

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

Posted on 2014-01-02
4
1,245 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 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

This script will sweep a range of IP addresses (class c only, 255.255.255.0) and report to a log the version of office installed. What it does: 1.)      Creates log file in the directory the script is run from (if it doesn't already exist) 2.)      Sweep…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

763 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