Replace microsoft forms message box with something more meaningful

F

Forum Freak

Hi

I have a userform with a combobox whos "match entry" property is set to
True. If the user enters invalid text they get a microsoft forms message
saying invalid property value.
How do I change the message to something more meaningful.

I would be grateful for any help

Kenny W
XP pro and Office 2003
 
D

Dick Kusleika

I have a userform with a combobox whos "match entry" property is set to
True. If the user enters invalid text they get a microsoft forms message
saying invalid property value.
How do I change the message to something more meaningful.

There is not built in way to change that message.

I have an alternate suggestion. Change the Style property from Combo to
DropDown. That will prevent the user from entering invalid characters and
obviate the need for a message.

If you still want to roll your own, you'll need to set MatchEntry to False,
then use the Change event to cycle through the list to determine when an
invalid character is entered. Unfortunately, Excel doesn't have a NotInList
event like Access.

If you like, I can write some basic Change event code that will get you
started.
 
F

Forum Freak

Thanks for looking at this one Dick

The problem occured after I changed the Style from Combo to list! Under
normal circumstances the messagebox never occurs however I can evoke the bug
in the following manner.

There is a command button on the userform which when clicked clears all the
text boxes and comboboxes. After this has been used it is possible to
select the comboboxes whos style is set to list rather than combo. If you
single click the empty box but dont do anything else , then click in another
box or button you get the dreaded "invalid property value" message. This
locks everything until you enter correct details into the List type boxes.

This is ok as ultimately this is what I want however some users will not
understand what to do, hence the need for a user friendly message. I
currently have a label on the userform displaying what to do in the event
of... however it smacks of unprofessionalism.

Thanks for the offer of writing some code but I will decline for now.
Whilst writing this I have just thought perhaps I should change the code
behind my clear button. I wonder if not clearing these two boxes or
replacing the text to something within the list will cure the bug?

Thanks for your continued assistance over the years.

Regards
Kenny
 
D

Dick Kusleika

There is a command button on the userform which when clicked clears all the
text boxes and comboboxes. After this has been used it is possible to
select the comboboxes whos style is set to list rather than combo. If you
single click the empty box but dont do anything else , then click in another
box or button you get the dreaded "invalid property value" message. This
locks everything until you enter correct details into the List type boxes.

You're right, that's exactly how it works. How silly. It appears that if
you change MatchRequired to False, you can avoid this problem. If the Style
is still DropDown, the user can't enter anything that's not on the list. So
it seems that MatchRequired does nothing (other than cause errors) if the
Style is DropDown.
Thanks for the offer of writing some code but I will decline for now.
Whilst writing this I have just thought perhaps I should change the code
behind my clear button. I wonder if not clearing these two boxes or
replacing the text to something within the list will cure the bug?

Yeah you don't need any code, I misunderstood the question. Try changing
Match Required to False and see if that gives you better behavior, even if
it's not exactly what you may want.
 
F

Forum Freak

Thanks for continuing with this thread.

As I was hell bent on stopping users screwing up the database I would have
never considered setting MatchRequired to False!

Needless to say I have tested it on my spreadsheet and it works.

Thanks again
Kenny
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top