• Capture vbCancel of input box (2000)

    Author
    Topic
    #413453

    I have the following code:
    strReturn = InputBox(“please enter something”)
    if strreturn = vbcancel
    ‘User pressed cancel
    else if IsEmpty(strreturn)
    ‘User pressed okay without entering anything
    else
    “user entered something go on validating.
    endif

    This code errors as the strrturn is of different type to vbcancel.

    How do you capture a vbcancel of an input box?

    Thank you in advance
    Cindy

    Viewing 1 reply thread
    Author
    Replies
    • #912396

      The InputBox function returns an empty string "" if the user cancels it. There is no way to determine whether the user deliberately left the box empty and pressed OK, or pressed Cancel.

      • #912400

        Thanks Hans,

        I guess I shall just use the empty string as a cancel and assume if the user didn’t enter anything best we cancel what ever they are doing as they aren’t certain themselves.

        Thanks

        Cindy

      • #912401

        Thanks Hans,

        I guess I shall just use the empty string as a cancel and assume if the user didn’t enter anything best we cancel what ever they are doing as they aren’t certain themselves.

        Thanks

        Cindy

      • #912486

        Doesn’t post 393694 cover this?

        • #912488

          Good point, I had forgotten about that one. Thanks for digging it up.

        • #912489

          Good point, I had forgotten about that one. Thanks for digging it up.

      • #912487

        Doesn’t post 393694 cover this?

    • #912397

      The InputBox function returns an empty string "" if the user cancels it. There is no way to determine whether the user deliberately left the box empty and pressed OK, or pressed Cancel.

    Viewing 1 reply thread
    Reply To: Capture vbCancel of input box (2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: