samedi 15 février 2020

Pass CheckBox-Objects

How do I have to pass CheckBox-Objects correct to other Subs/Functions? Had to pass it multiples times. For illustation it worked for case 1: MsgBox "1) " & ckBox.Name but not in: case 2: MsgBox "2) " & ckBox.Name

It starts with a Click-Event from the ClickBox in "ControlBox_Click_100".

# Modul_1 ---------------------------------------------------
Sub ControlBox_Click_100()
    Call fColOnOff(bRowSearch, "New", "Old", , True)
End Sub


# Modul_2 ---------------------------------------------------
Sub fColOnOff(ByVal bRow As Byte, Optional ByVal sSuchen1 As String, _
                                  Optional ByVal sSuchen2 As String, _
                                  Optional ByVal sSuchen3 As String, _
                                  Optional ByVal bolSuchen2 As Boolean, _
                                  Optional ByVal bolSuchen3 As Boolean) _

Call fActCheckBox

    MsgBox "2) " & ckBox.Name

...

End Sub


# Modul_2 ---------------------------------------------------
Private Sub fActCheckBox()

Dim ckBox As CheckBox
Set ckBox = ActiveSheet.CheckBoxes(Application.Caller)

    MsgBox "1) " & ckBox.Name

End Sub



Aucun commentaire:

Enregistrer un commentaire