A User is Entering Data into the Edit Region of a ComboBox
The ComboBox's Change Event is used to run the following Code;
AppActivate "Microsoft Excel"
:
'Do some stuff
:
UserForm1.Show
UserForm1.ComboBox1.SetFocus
This works OK, BUT; even though the ComboBox now has the Focus again (according to the Userform.ActiveControl anyway), it has no Insertion Pointer to indicate this fact, and the User has to Re-Select the ComboBox before he can continue entering Data
I would like to have it so that the Insertion Pointer reappears and the User can continue Entering Data directly, without having to Re-Select the ComboBox
Adding the following line of Code
SendKeys "{TAB}+{TAB}{RIGHT}"
is one solution, but it is messy (it generates ComboBox Events and using SendKeys is best avoided if possible anyway)
Can anyone suggest a better solution?
Q. Why do black sheep eat less than white sheep?
A. Because there aren't as many of them
the thing is , the userform itself might not have focus over the worksheet or other userforms.
Try this code:
or more generally to set properly focus, call this sub:
I also use that kind of code to move focus to the Form when i need ControlTipText showing on hover. If the Form has no focus, the Text bubbles won't show on mouse hover...
At the end of the UserForm Change Event add the code:
Inside a Module add the code:
I've run into this several times. For some reason it will work when being called from a module. The One Second is hardly noticeable to the end user. If you prefer, you can also add it earlier in the event code, it will wait until the current routine is finished and then run immediately following (1 second - time taken for the remaining code). Hope this helps.
After
add