ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   test if a control has or doesnt have focus? (https://www.excelbanter.com/excel-programming/282192-test-if-control-has-doesnt-have-focus.html)

John T Ingato

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

Event handlers are called even when the associated event wasn't user
generated. for example, if a listbox is updated in another method


Sub listbox_click()

some code

End sub


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



Sub listbox_click()

if gotfocus(listbox) then some code

End sub




All times are GMT +1. The time now is 09:59 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com