Visio Guy

Visio Discussions => Programming & Code => Topic started by: davidjcrowell on March 10, 2015, 04:29:24 PM

Title: Toggle Layer Buttons
Post by: davidjcrowell on March 10, 2015, 04:29:24 PM
I've been designing a visio process design toolkit and it's got quite a few layers in it.  I thought it would be helpful to create some toggle buttons for easier navigation by the user.  Because there are so many toggle options, I thought it would be helpful to have them on a separate tab in Visio.  Is it possible to toggle layers on one tab from toggle buttons in a separate tab? 

I'm using the following code which works very well for toggling layers on the same tab.

Private Sub CheckBox1_Click()
    Dim myLayerName As Visio.Layer
    On Error Resume Next
    Set myLayerName = ActivePage.Layers(CheckBox1.Caption)
    If myLayerName Is Nothing Then Exit Sub
    myLayerName.CellsC(visLayerVisible).Formula = CheckBox1.Value
    myLayerName.CellsC(visLayerPrint).Formula = CheckBox1.Value
End Sub