Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/circui15/public_html/packetpros.com/index.php:4) in /home/circui15/public_html/packetpros.com/wp-content/plugins/wp-file-upload/wordpress_file_upload.php on line 2

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/circui15/public_html/packetpros.com/index.php:4) in /home/circui15/public_html/packetpros.com/wp-content/plugins/wp-file-upload/wordpress_file_upload.php on line 2
Code for button in Visio

In Visio I like to use buttons to turn layers on and off. Here’s code that uses a single button for turning on and off the layer named ‘Switch’.

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
Set LayerCellObj = LayerObj.CellsC(visLayerVisible)
If LayerName = "Switch" Then
' Debug.Print LayerName
If LayerCellObj.Formula = False Then

LayerCellObj.Formula = True

Else
LayerCellObj.Formula = False
End If
End If
Next

End Sub