LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default TOGGLE BUTTON on userform problem


"davidm" wrote in message

Thanks, Peter, for your input. The global variable (bExit in the
example) can ensure the event fires but once only if it (the global
variable) is used elsewhere in other procedures in the module. Do you
suggest, I introduce the variable in all these other procedures (15 of
them) and set bExit =false next to Exit Sub?


Possibly, depending on what you are doing, Eg -
Say you have code to loop through sheets resetting the up/down state (value)
of activeX togglebuttons as relate to each sheet. You don't want the code in
the click event to do anything if the value changes.

In each click event
If bExit Then Exit Sub

In the main routine, as per original example, bExit = True before the loop
and false at the end.
You could also set bExit = True in all routines that might trigger events
you don't want processed, eg
If bExit Then Exit Sub
bExit = True
'code
bExit = False

Be careful to ensure bExit is reset False when done, normally best to
include an error handler as in original example.

Maybe, guessing, you only want click event processed depending on the state
of the new value, eg

If myToggle.value = true Then
'do normal code even if bExit = True
Elseif bExit Then
' do nothing
Else
' some reset code
End if

Regards,
Peter T



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Toggle Button mick2 Excel Discussion (Misc queries) 5 November 27th 05 05:52 AM
Toggle button keithl816 Excel Discussion (Misc queries) 2 November 21st 05 09:16 PM
Adding .xla button for Toggle Calculation Button Mike Excel Programming 5 August 19th 05 01:55 PM
Toggle Button Keri[_2_] Excel Programming 2 May 28th 04 04:58 PM
Toggle Button Ben E[_2_] Excel Programming 1 October 29th 03 04:42 PM


All times are GMT +1. The time now is 04:59 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"