mardi 6 juin 2017

grey out checkbox2 and checkbox3 unless checkbox1 = true

Another VBA dilemma for you.

I have checkbox1, checkbox2 and checkbox3. I would like checkbox2 and checkbox3 to be greyed out if checkbox1=true I have used a code similar for greying out a textbox

    Private Sub CheckBox1_Click()
    Dim en As Boolean
    en = Not CheckBox1.Value
    EnableControls Array(tbappgn, tbappfn), en

'utility sub: enable/disable controls
Private Sub EnableControls(cons, bEnable As Boolean)
    Dim con
    For Each con In cons
        With con
            .Enabled = bEnable
            .BackColor = IIf(bEnable, vbWhite, RGB(200, 200, 200))
        End With
    Next con
End Sub

But if this is applied to the checkbox it greys out the whole checkbox object. Anyone know how to grey out the font and maybe make the boxes black???? or something along those lines anyway - happy to provide more information if required :):):):):):)




Aucun commentaire:

Enregistrer un commentaire