View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Italian Job Italian Job is offline
external usenet poster
 
Posts: 6
Default Problems with event handlers

Is it possible for me to test if a control does or doesnt have focus?

Some event handlers are called even when the associated event wasn't user
generated. For example, if a listbox.list is updated in another method, the
listbox_click handler is called.


Sub listbox_click()

some code

End sub


Can I test to see if the user clicked the control or if another method
called it, by
testing for focus? For example:



Sub listbox_click()

if gotfocus(listbox) then some code

End sub

The code inside the event handler is executing when I don't want it to. Is
there a way to stop this?