To maybe say the same thing as Tom, but in a different manner ...
The routine exits when bBlockEvents is true.
It continues if bBlockEvents is false, but immediately sets it to True so
that if the event gets triggered recursively, it will immediately exit.
At the end, it resets bBlockEvents to False so that any new event triggering
will not immediately exit.
--
HTH
RP
(remove nothere from the email address if mailing direct)
"Nicole B" wrote in message
...
I'm confused. I thought that the sub was exiting when bblockevents=false,
as
below (noted with asterisk). Otherwise, why wouldn't the sub end before
the
msgbox?
Public bBlockEvents
Private Sub ToggleButton1_Click()
If bBlockEvents Then Exit Sub
bBlockEvents = True
MsgBox ToggleButton1.Value
With ToggleButton1
.Caption = "Protect Sheets"
.Value = False
End With
* bBlockEvents = False
End Sub
"Bob Phillips" wrote:
This is because bBlockEvents is a boolean (True/False) variable, and
this is
the same as saying
If bBlockEvents = True Then Exit Sub
--
HTH
RP
(remove nothere from the email address if mailing direct)
"Nicole B" wrote in message
...
I was wondering... how does your statement:
If bBlockEvents Then Exit Sub
work? is VB assuming some kind of value?