+ Reply to Thread
Results 1 to 5 of 5

Need help to change ComboBox error message

  1. #1
    Registered User
    Join Date
    05-27-2011
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2007
    Posts
    72

    Need help to change ComboBox error message

    I have a ComboBox that requires the user selects an item from the list (if anything else snuck in it would cause unspeakable horrors, this must be moronproof) so I set the MatchRequired property to TRUE. The problem is the rediculous error that would confuse the user as I anticipate the user will be a beginner of the most primitive kind.

    How can I change the error message from "Invalid property value." to something more obvious like "Select from the list, IDIOT!" (just an example, my message will not be quite that angry)? While I'm at it, the error box's standard title of "Microsoft Forms" would be better off as something custom as well.

    I am aware of changing the Style to require someone to actually pick from the list with no option of typing but this in itself is a problem as the list has 486 entries which all start with one of three values and are a combination of letters and numbers that cannot truly be put into alphabetic/numeric order and be at all simple to find.

    ex: (all start with P, T or M but have random characters following)
    P413MT12
    P2175F34
    PH12367L
    T690UD0
    T3D541
    TG45CV
    M402M43
    MDF348R
    M98G98L
    etc...

    So my only solution I think would be to find a way to change that error message (and error box title). Can it be done, and how?

    Thanks in advance!
    Last edited by nohero; 06-03-2011 at 08:45 AM.

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Need help to change ComboBox error message

    nohero,

    Leave the MatchRequired property as false. Then, put the following in whatever checks the combobox value (in my test userform it was a button):

    Please Login or Register  to view this content.


    This works because if the combobox is empty or if the text in the combobox does not match anything in its list, the ListIndex = -1
    So you can use that to generate an error message like above.

    Hope this helps,
    ~tigeravatar
    Last edited by tigeravatar; 06-03-2011 at 12:41 PM.

  3. #3
    Registered User
    Join Date
    05-27-2011
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2007
    Posts
    72

    Re: Need help to change ComboBox error message

    Thank you so much, that works perfectly.

    I envisioned that the error would come immediately after attempting to change fields but this is just as good. Exactly the result I was hoping for.

    Cheers!

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Need help to change ComboBox error message

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution. Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.
    To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.

    PLEASE PM WHEN YOU HAVE DONE THIS AND I WILL DELETE THIS POST
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  5. #5
    Registered User
    Join Date
    11-13-2015
    Location
    Nicaragua
    MS-Off Ver
    2007
    Posts
    1

    Re: Need help to change ComboBox error message

    Hi,

    I know it was long time ago, but maybe it works for somebody.

    If you want to do inmediatly, as match requiered property does, you can put the same code into the event exit of the combobox object. And that's it, the same function. You have to put the match requiered as false.

    In the other hand, if you don't want to allow write anything else than the items in the list on the combobox, you can change the Style property to DropDownList.

    Regards,

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1