Firslty forgive me if this has been posted. I have been surfing a resolution for some time, and while I see several suggestions none seem to get to the bopttom of the problem. So here it is:
Excel 2007 (but I think the issue is across versions)
I have userforms in my excel vb app containing a number of controls. The issue I am seeing predominantly relates to a small form that is used to login to the app..i.e. username and password. It has a frame with a combobox and textbox within, and another frame with two command buttons. It couldn't be more basic.
The issue is that randomly I am not able to tab or enterkey away from the textbox, thus passing focus to my 'OK' command button. tab's just insert a Tab in the field, Enter key has no effect.
Before responding to this post bear in mind the following:
- The textbox controls are correct to allow this to work...tabkeybehavior etc.
- Just to make sure I set these values in code also in the form activate event
- The issue only seems to happen on the first time the form is used when opening excel and sometimes not even then
- I have used vba.replace to force the tab to shift focus to the command button, which does work, but interestingly when the commandbutton gets focus I can't press it with the enter key...only a mouse click
- Enter key should behave like a tab but the cursor just stays in the textbox
- Now here's the especially interesting aspect of the issue; If I click away from excel to another app (e.g.IE) and back again, it works fine. Does anyone have code that can emulate this seemlessly? i'd bite your hand off for it
- I have also noted the changes to the forms code, sometimes makes the problem go away, albeit temporarily
So in summary, i am pretty convinced I'm not looking at code or parameter issue. I am more and more convinced that it is just a Excel VB bug. Has anyone else had this issue, and if so did you find a viable solution or workaround?
Thanks in advance
Bookmarks