Results 1 to 5 of 5
  1. #1
    Star Lounger
    Join Date
    Jan 2002
    Location
    London, Gtr London, England
    Posts
    63
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Capture vbCancel of input box (2000)

    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

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Capture vbCancel of input box (2000)

    The InputBox function returns an empty string <code>""</code> 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.

  3. #3
    Star Lounger
    Join Date
    Jan 2002
    Location
    London, Gtr London, England
    Posts
    63
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Capture vbCancel of input box (2000)

    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

  4. #4
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Capture vbCancel of input box (2000)

    Doesn't <post#=393694>post 393694</post#> cover this?

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Capture vbCancel of input box (2000)

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

Posting Permissions

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