+ Reply to Thread
Results 1 to 9 of 9

Validation on clicking "Cancel" on messagebox.

  1. #1
    Forum Contributor
    Join Date
    02-21-2011
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    100

    Validation on clicking "Cancel" on messagebox.

    Hey everyone!

    Quick question!
    Here's my code

    Please Login or Register  to view this content.
    Everything works good, but theres a couple of things:

    1) When the InputBox appears, the user can click "Cancel" and the backup still runs, and names the file 'False.xls' - How do I block this from happening?

    2) Maybe related to what I mentioned in 1) but what code do I put so that the user cannot leave the field blank and clikc 'OK'?

    Thanks
    Last edited by excelit; 05-02-2011 at 08:32 AM.

  2. #2
    Valued Forum Contributor realniceguy5000's Avatar
    Join Date
    03-20-2008
    Location
    Fl
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    951

    Re: Validation on clicking "Cancel" on messagebox.

    Maybe you can try?

    Thank You, Mike

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    02-21-2011
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    100

    Re: Validation on clicking "Cancel" on messagebox.

    Quote Originally Posted by realniceguy5000 View Post
    Maybe you can try?

    Thank You, Mike

    Please Login or Register  to view this content.
    Worked Great on the Cancel button, Thanks

    If I click the OK button without a name, I get a "Formula error" for some reason. Any ideas on that?

  4. #4
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Validation on clicking "Cancel" on messagebox.

    You'd better perform these 'system' tasks without bothering the user:

    Please Login or Register  to view this content.



  5. #5
    Forum Contributor
    Join Date
    02-21-2011
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    100

    Re: Validation on clicking "Cancel" on messagebox.

    Quote Originally Posted by snb View Post
    You'd better perform these 'system' tasks without bothering the user:

    Please Login or Register  to view this content.
    Bothering the user? It just asks for name and then shows a box when its backed up

    what does your code do?

  6. #6
    Valued Forum Contributor realniceguy5000's Avatar
    Join Date
    03-20-2008
    Location
    Fl
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    951

    Re: Validation on clicking "Cancel" on messagebox.

    Quote Originally Posted by excelit View Post
    Worked Great on the Cancel button, Thanks

    If I click the OK button without a name, I get a "Formula error" for some reason. Any ideas on that?
    Hi, Since your looking for a name, Maybe you can use a type 2 input box as you are using a 1 now.

    Then you can put this under the line I gave you before.

    Please Login or Register  to view this content.
    See how that works for you, Mike

  7. #7
    Forum Contributor
    Join Date
    02-21-2011
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    100

    Re: Validation on clicking "Cancel" on messagebox.

    Quote Originally Posted by realniceguy5000 View Post
    Hi, Since your looking for a name, Maybe you can use a type 2 input box as you are using a 1 now.
    My code now:
    Please Login or Register  to view this content.
    Doesnt work now :S
    If i leave the box blank, it shows the box and doesnt run..but if I put a name and click OK, it does nothing

  8. #8
    Valued Forum Contributor realniceguy5000's Avatar
    Join Date
    03-20-2008
    Location
    Fl
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    951

    Re: Validation on clicking "Cancel" on messagebox.

    Try This: Thank you, Mike

    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    02-21-2011
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    100

    Re: Validation on clicking "Cancel" on messagebox.

    Worked, Thanks!
    REP Added

+ 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