chaning a checkbox value with a macro


Posted by Damien on June 24, 2001 7:34 PM

I need to know how to change the value of checkbox witha macro it can be done with a button's code but these are private subs anyone?



Posted by Dax on June 25, 2001 3:46 AM

You can only control a userform from an another macro if you show the userform as vbModeless. E.g. if you had a userform (userform1) with a single checkbox (chk) then insert a module and try this: -

Sub Frm()
UserForm1.Show vbModeless

UserForm1.chk.Value = True

'Wait 3 seconds
t = Timer
While Timer < t + 3
DoEvents
Wend

'Change the checkbox value to unchecked
UserForm1.chk.Value = False

End Sub

HTH,
Dax.