View Single Post
 
Old 12-03-2018, 10:17 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,977
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

As another minor cleanup, I would make use of the checkbox captions to make it more obvious how each checkbox aligns to a layer.
Make sure the checkbox caption is the same as the layer name it reveals and change all the checkbox macros to reflect the text in the checkbox caption eg.
Code:
Public Sub CheckBox2_Click()
  ShowHideLayer CheckBox2.Caption, CheckBox2.Value
End Sub
If this was done, you could then go even cleaner and pass in just the control itself and get the two values from the control itself
Code:
Public Sub CheckBox1_Click()
  ShowHideLayer2 CheckBox1
End Sub

Public Sub CheckBox2_Click()
  ShowHideLayer2 CheckBox2
End Sub

Public Sub CheckBox3_Click()
  ShowHideLayer2 CheckBox3
End Sub

Public Sub ShowHideLayer2(aCheckbox As Object)
  Dim aPage As Visio.Page, aLayer As Visio.Layer
  For Each aPage In ActiveDocument.Pages
    For Each aLayer In aPage.Layers
      If aLayer.Name = aCheckbox.Caption Then
        aLayer.CellsC(visLayerVisible).Formula = aCheckbox.Value
      End If
    Next aLayer
  Next aPage
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote