View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Nicole B Nicole B is offline
external usenet poster
 
Posts: 8
Default toggle button or worksheet_activate causing form to open twice

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?