-
web browser control focus trouble!
I have a form with a web browser control that does a search in GoogleMaps on every SelectionChange event. The problem is it steals the focus from the worksheet when the query is done - this is a big problem for me because it forces me to use the mouse which makes my wrists suffer.
Anyways, I've found a workaround for that - on the NavigateComplete2 event of the browser control, I use Application.OnTime to call a subroutine that transfers the focus to the worksheet. The reason I use OnTime instead of transferring the focus directly is that if I transfer the focus directly it will happen before the browser steals it.
Now, since I send Now as the earliest time for the OnTime it works pretty good and I don't feel the focus back and forth transfer, but still, it's a pretty ugly workaround, since OnTime won't recognize a form's subroutine even if I use "FormName.SubroutineName" so I need to create a function on a module, and more importantly - if I want to use another form to scan the rows I need to write more code that recognize who was the previous focus holder and return it to it instead of automatically return it to the worksheet.
So, does anyone know a more elegant solution to this problem?
Last edited by Simon Lloyd; 09-04-2010 at 10:42 AM.
Reason: Changed title for something less offensive!
-
"The reason I use OnTime instead of transferring the focus directly is that if I transfer the focus directly it will happen before the browser steals it."
Would adding a Wait command fix that issue?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules