Hiding shapes by clicking button

Started by Zäsch, May 16, 2018, 12:25:28 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


Hallo Visio Guys,

I have a rather special request and don't know if my approach could lead to success.
The situation is that I have a visio file including various shapes displaying a structure of applications and servers that generate reports.
Not every report needs every server or app so the idea is to hide the shapes and only display the ones generating the report.
Since the chart itself will continuosly be growing I thouhgt it would be a good Idea to have everything on one page and simply hide the shapes that are not needed for the report selected.
Another idea was to create a new page for every report which has one giant drawback: everytime a shape changes it has to be changed in every single page which is simply too much work.
Yet another idea was to create some kind of excelsheet give each shape a value and make visio generate pages by itself so only the excel sheet has to be updated and every other shape will appear automatically.
Is visio even the right tool for this task?

If anyone has any idea please let me know.

Grüße from Germany

Paul Herber

Have a look at layers. Layers belong to a page, and shapes can be members of those layers. The layers can then be made visible or invisible.
Electronic and Electrical engineering, business and software stencils for Visio -



Adding to Paul's comment, you can then add actions to easily toggle the layers on / off.

Visio 2019 Pro


An alternative to using layers is to build the ability for the shape to be hidden via a cell in its shapesheet, so by code you would have to turn shapes visibility on or off. This can give you more flexibility if the shapes that are in the reports can change or a new report with a different subset of shapes is required.
Live life with an open mind


Thank you all for your quick answers!
Highly apprechiated.

I will have a look at it and will provide you with the results.


if you want to stay away from VBA and use shapesheet, can do these

action = setf(getref(action.checked), if(action.checked, 0, 1)) + setf(getref(geometry1.noshow), if(action.checked, 0,1))

First setf sets the click flag on the shape dropdown
second, turns the shape display on or off

If You don't want to use layers, you could set flags in page shapesheet to turn catagoires of shapes

shape user cell = setf(getref(geometry1.noshow), if(page!user.x = 1, 0,1))

This would check a page user cell as to whether to show or hide all shapes of this categorie.
In essence, this is similar to layers but using some user specific set of categories to trigger on or off.

<obviously, sloppy syntax...but quite doable...use it all the time>


Some pros / cons on shapesheet vs vba.
Shapesheet:  avoids macro security issue, is built into Visio.  Disadvantage:  both layers and Vojo's methods require some a priori knowledge as to setting each sheet's identity, e.g., assign to specific layers.  Both require this on a per page basis, e.g., layers not global, but per page.  Similarly, Vojo's approach also needs per page pre-planning.  But both will work fine once setup.

Macro: security issue biggest obstacle.  Obviously, some code writing.  Most flexible.  Other than writing code, not necessary to do pre-planning.  Could be set such that it ignores selected shapes.  Thus, you select shapes not wanted, run macro, shapes become hidden, generate report, then, unhide shapes.

All three methods can do the task.

Visio 2019 Pro