Hide/show Layer

Started by mwieting, April 18, 2017, 04:04:58 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

mwieting

I have a Visio diagram that i want display different layers by having a toggle button to hide/she a particular layer.  I am not to overly knowlegeable with my VBA scripting. Could anyone give me some insight?

Surrogate

Quote from: mfm150 on April 13, 2017, 04:44:23 PM
I am able to toggle visibility based on which option is selected.

mwieting


Surrogate


mwieting

So how can you help me with my question.

Surrogate

i share to you link where you can see same question ! or i am wrong ?

Surrogate


Nikolay

Quote from: mwieting on April 18, 2017, 04:04:58 PM
I have a Visio diagram that i want display different layers by having a toggle button to hide/she a particular layer.  I am not to overly knowlegeable with my VBA scripting. Could anyone give me some insight?

David Parker has recently released a tool that probably can help you with that:
https://blog.bvisual.net/2017/03/09/layer-manager-add-in-for-visio-released/

If you want to build it yourself, you can refer to this article:
https://blog.bvisual.net/2007/10/08/toggling-layers-on-and-off/

If you want layer switch on a webpage, you can give a try to my web-export:
http://unmanagedvisio.com/products/svg-publish/   (example with layers)

migseye

I used this code I found how to create on a layers tutorial on youtube

To use, type in
Call LayerToggle(20, 0)

20 is the layer you want toggled. The 0 means off, it is was on it would be 1


Sub LayerToggle(ItemNBR As Integer, OnOff As String)

    'Enable diagram services
    Dim DiagramServices As Integer
    DiagramServices = ActiveDocument.DiagramServicesEnabled
    ActiveDocument.DiagramServicesEnabled = visServiceVersion140 + visServiceVersion150

    Dim UndoScopeID1 As Long
    UndoScopeID1 = Application.BeginUndoScope("Layer Properties")
    Dim vsoLayer1 As Visio.Layer
    Set vsoLayer1 = Application.ActiveWindow.Page.Layers.Item(ItemNBR)
    vsoLayer1.CellsC(visLayerVisible).FormulaU = OnOff
    vsoLayer1.CellsC(visLayerPrint).FormulaU = OnOff
    Application.EndUndoScope UndoScopeID1, True

    'Restore diagram services
    ActiveDocument.DiagramServicesEnabled = DiagramServices
   
   

End Sub