Author Topic: Is there an easy way for other novice users to switch visible layers  (Read 206 times)

0 Members and 1 Guest are viewing this topic.

William Douglas

  • Newbie
  • *
  • Posts: 6
  • Water, water, water every wear
Hello and good day everyone.

My first post here - so please be patient.

Have used Visio for many years (but a DIY learner, so totally green in many areas of it), and still stuck on Visio 2007. Hope this has a solution in that dinosaur.

I have a self facilitating roadmap template, have all the instructions assigned to one layer, and the user entry fields aligned with these in another layer.

The user may be Visio illiterate, or the menu structure may be different in later versions of Visio
How do I implement a single click button to achieve this ?
    [Menu [View [Layer Properties  {Toggle Visible.Content or Visible.TemplateInfo}

Is there even VBA macro support in Visio-2007?
And if so, was there anything user friendly like the [Record Macro] that Microsoft Excel provided - my quick and easy way to create starting point macro, from where I would modify it for my needs.

Thanks in advance,
Will
« Last Edit: November 13, 2018, 05:39:49 AM by William Douglas »
Visio 2007 Intuitive - all learned on a need to know basis

Paul Herber

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2672
    • Paul Herber's website
Re: Is there an easy way for other novice users to switch visible layers
« Reply #1 on: November 13, 2018, 05:48:44 AM »
VBA and macros have been in Visio from the year dot.
In Visio 2007 do:
menu Tools -> Macro
Electronic and Electrical engineering, business and software stencils and applications for Visio -

http://www.paulherber.co.uk/

Paul Herber

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2672
    • Paul Herber's website
Re: Is there an easy way for other novice users to switch visible layers
« Reply #2 on: November 13, 2018, 05:52:42 AM »
From Visio 2010 onwards the menus have been replaced by the much-unloved ribbon. So, any UI feature for Visio 2007 will be different in Visio 2010 onwards.
Electronic and Electrical engineering, business and software stencils and applications for Visio -

http://www.paulherber.co.uk/

William Douglas

  • Newbie
  • *
  • Posts: 6
  • Water, water, water every wear
Re: Is there an easy way for other novice users to switch visible layers
« Reply #3 on: November 13, 2018, 06:59:21 AM »
Thanks Paul,

Recorded the two macros - not exactly self-explanatory in VBA (why don't my Layer names show?)

How can I link each macro to a button on the screen, else User has to be prompted to type  Ctrl^Q  and Ctrl^P   ?

Code: [Select]
Sub Content()
' Show content
' Keyboard Shortcut: Ctrl+Shift+Q
'   <snipped to kernel code />
    Set vsoLayer1 = Application.ActiveWindow.Page.Layers.Item(2)  'Template layer
    vsoLayer1.CellsC(visLayerVisible).FormulaU = "0"
    Set vsoLayer1 = Application.ActiveWindow.Page.Layers.Item(1) 'Content layer
    vsoLayer1.CellsC(visLayerVisible).FormulaU = "1"
Visio 2007 Intuitive - all learned on a need to know basis

William Douglas

  • Newbie
  • *
  • Posts: 6
  • Water, water, water every wear
Re: Is there an easy way for other novice users to switch visible layers
« Reply #4 on: November 13, 2018, 07:01:46 AM »
So I'll test in V2010+ and report back here
Visio 2007 Intuitive - all learned on a need to know basis

vojo

  • Hero Member
  • *****
  • Posts: 1163
Re: Is there an easy way for other novice users to switch visible layers
« Reply #5 on: November 13, 2018, 09:03:23 AM »
is there a reason why you didn't use docmd(1446) in an action row in the shape sheet?

Action.layers = docmd(1446)

if you right click the shape or group of shapes (should check if it works at the page level), and select layers, it will
launch the layer dialog.   User can hide/show various layers.   when done, exit....if you need it again, repeat.

William Douglas

  • Newbie
  • *
  • Posts: 6
  • Water, water, water every wear
Re: Is there an easy way for other novice users to switch visible layers
« Reply #6 on: November 13, 2018, 09:57:10 AM »
Yes - 2 reasons

1. Was on the path to use a macro to do this, intending to launch the macro from a button on the sheet.

2. Docmd(), action row, shapesheet - that's all jargon to me at this stage.
    I've used Visio to draft engineering diagrams until now, that's about it
    - Testament to how intuitively good the UI is, haven't needed to use anything but the visual elements until now.

But I'll try pick up on the jargon, it may well work better in this case
Visio 2007 Intuitive - all learned on a need to know basis

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3329
  • Ideas Visio-lized into solutions
Re: Is there an easy way for other novice users to switch visible layers
« Reply #7 on: November 13, 2018, 02:27:34 PM »
The Action section of the shapesheet allows you to create quick access actions.  These appear in the pop-up menu when you right click a shape. 

A good starting place is this (don't let the V2003 reference alarm you, it's still the same technique):  https://stackoverflow.com/questions/132860/how-do-i-add-an-action-to-visio-2003

Explanation of the various entries of an Actions row:  https://docs.microsoft.com/en-us/office/client-developer/visio/actions-row-actions-section

A good background on Visio is found here:  https://docs.microsoft.com/en-us/previous-versions/office/developer/office-xp/aa165776(v%3doffice.10).  This about the best document describing the full range of things Visio.  Explore it.

More recent shapesheet reference:  https://docs.microsoft.com/en-us/office/client-developer/visio/visio-shapesheet-reference


Visio 2019 Pro

William Douglas

  • Newbie
  • *
  • Posts: 6
  • Water, water, water every wear
Re: Is there an easy way for other novice users to switch visible layers
« Reply #8 on: November 14, 2018, 05:52:19 AM »
Thanks wrapperdude,

Cos I had no joy finding any good V2007 helpfile stuff on action row, docmd, shapesheet.

I'll look through your ideas shortly.

For now the macro solution is working well, and it links to "buttons" quite easily.

A bit disconcerting that the macro name in the copy (for project name sanitization) references the original VSD file although a local copy actually is made.

Here's how to link the macro to the "button" - any shape will do, something that looks like a button makes more sense

Ok - inline images going to take a while to figure out, looks like must load on a hosting site and post the URL ..... for now as attachments




Visio 2007 Intuitive - all learned on a need to know basis