Shadowspawn
[H]ard|Gawd
- Joined
- Sep 17, 2002
- Messages
- 1,870
I am working on a network diagram with Visio 2013 and need a way to toggle some connectors off and on. The trick is that when one layer is turned off I want the other layer to turn on. Here is what I have at the moment:
These are four buttons. The first two turn layer 1 (Core 1 connections) off or on. The second two do the same for layer 2 (Core 2 connections). I know I can do this in one button but my programming skills are nonexistent. I can figure it out over the course of a couple of days but I was hoping someone here could look and knock it out in five minutes.
Code:
Private Sub CommandButton1_Click()
Dim LayersObj As Visio.Layers
Dim LayerObj As Visio.Layer
Dim LayerName As String
Dim LayerCellObj As Visio.Cell
Set LayersObj = ActivePage.Layers
For Each LayerObj In LayersObj
LayerName = LayerObj.Name
' Debug.Print LayerName
If LayerName = "Core 1 connections" Then
Set LayerCellObj = LayerObj.CellsC(visLayerVisible)
LayerCellObj.Formula = False Or 0
End If
Next
End Sub
Private Sub CommandButton2_Click()
Dim LayersObj As Visio.Layers
Dim LayerObj As Visio.Layer
Dim LayerName As String
Dim LayerCellObj As Visio.Cell
Set LayersObj = ActivePage.Layers
For Each LayerObj In LayersObj
LayerName = LayerObj.Name
' Debug.Print LayerName
If LayerName = "Core 1 connections" Then
Set LayerCellObj = LayerObj.CellsC(visLayerVisible)
LayerCellObj.Formula = True Or 1
End If
Next
End Sub
Private Sub CommandButton3_Click()
Dim LayersObj As Visio.Layers
Dim LayerObj As Visio.Layer
Dim LayerName As String
Dim LayerCellObj As Visio.Cell
Set LayersObj = ActivePage.Layers
For Each LayerObj In LayersObj
LayerName = LayerObj.Name
' Debug.Print LayerName
If LayerName = "Core 2 connections" Then
Set LayerCellObj = LayerObj.CellsC(visLayerVisible)
LayerCellObj.Formula = True Or 1
End If
Next
End Sub
Private Sub CommandButton4_Click()
Dim LayersObj As Visio.Layers
Dim LayerObj As Visio.Layer
Dim LayerName As String
Dim LayerCellObj As Visio.Cell
Set LayersObj = ActivePage.Layers
For Each LayerObj In LayersObj
LayerName = LayerObj.Name
' Debug.Print LayerName
If LayerName = "Core 2 connections" Then
Set LayerCellObj = LayerObj.CellsC(visLayerVisible)
LayerCellObj.Formula = False Or 0
End If
Next
End Sub
These are four buttons. The first two turn layer 1 (Core 1 connections) off or on. The second two do the same for layer 2 (Core 2 connections). I know I can do this in one button but my programming skills are nonexistent. I can figure it out over the course of a couple of days but I was hoping someone here could look and knock it out in five minutes.