Closed Thread
Results 1 to 7 of 7

Inputbox cancel button error.

  1. #1
    abhay_547
    Guest

    Inputbox cancel button error.

    Hi All,

    I have the below code which I use to get some input from the user using input box when the user clicks on the cancel button it shows an error.

    Please Login or Register  to view this content.
    I tried to use below but still the user faces the error. Please help.

    Please Login or Register  to view this content.
    Thanks a lot for your help in advance.
    Last edited by abhay_547; 11-05-2010 at 06:31 AM.

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Inputbox cancel button error.

    Rather than use InputBox use Application.InputBox with Type 1 - this way W & H will both be 0 (exit/cancel) and you can validate on that basis.

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Inputbox cancel button error.

    Hello abhay_547,

    The code works fine for me and I'm using Excel 2003.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Inputbox cancel button error.

    Quote Originally Posted by Leith Ross View Post
    The code works fine for me and I'm using Excel 2003.
    Given the Long declarations the Exit/Cancel on a standard InputBox should throw a Debug, no ? If declared as Variant then it would work.

    Given the input type is defined (number) Application.InputBox would IMO be preferable as it would capture all erroneous entries at point of entry (not just Exit/Cancel)

  5. #5
    abhay_547
    Guest

    Re: Inputbox cancel button error.

    Hi Ote,

    Thanks a lot for your reply, can you please provide me with an example of what you are suggesting.

    Thanks a lot for your help in advance.

  6. #6
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Inputbox cancel button error.

    The link provided should have been sufficient.

    Please Login or Register  to view this content.
    You can then validate the variables to ensure the Longs are within acceptable boundaries (Cancel/Exit will return 0)

  7. #7
    abhay_547
    Guest

    Re: Inputbox cancel button error.

    Hi Ote,

    Thanks a lot for your reply, I have tested the code and it works fine. I have incorporated the same in my main code. Here is it :

    Please Login or Register  to view this content.
    Thanks a lot

Closed 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