macro boxes: toggle on/off

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello there, I have created a box with a macro assigned to it and I can click
it to run the macro but I would also like to be able to click it off, I've
seen this done before.

How can I do this? Is there some code to put into the already existing code
for that option?

Thanks...Peter
 
Hello Peter
Use the Toggle button control from the Controls tool box.
And use its Value property True / False to either Run / Not Run your macro.
eg:
Private Sub ToggleButton1_Click()
'Toggle is on : run my macro
If ToggleButton1.Value Then
'your macro to run
Macro1
'Toggle is off, exit code
Else: Exit Sub: End If
End Sub

HTH
Cordially
Pascal
 
Back
Top