Is there a way to limit user keys to patterns listed in item for combobox? If my items are - aaa,bbb,ccc -- then only the a key can be used if an a is depressed first, all other keys would be disregarded. I know how to do it in vb but not vba.
Thanks
Use the combo box's KeyPress event. The .Text property gives what's currently visible in the text box part (as opposed to the .Value property, which gives the last completely entered value). So just check .Text; if it's empty, any key is ok. If it's not empty, you test the keystroke for validity, and if it's not valid, you beep and set the KeyAscii argument to 0 to cancel the keystroke. Rick Sprague
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.