+ Reply to Thread
Results 1 to 7 of 7

Userform Open Close Help

  1. #1
    Forum Contributor
    Join Date
    05-23-2014
    Location
    Fredericia, Denmark
    MS-Off Ver
    Windows Office 2013, Excel 10
    Posts
    139

    Userform Open Close Help

    I've configured a workbook to open each time on the "Instructions" page. When users then click on another worksheet a UserForm Popup box activates asking the viewer to either "Accept" or "Decline" terms by checking one of two checkboxes. I would like to rewrite the code to close the workbook if they "Decline", and if they "Accept", to not show the PopUp box again if/when they navigate back to the "Instructions" page and then again to another worksheet.

    Also, it would be great if the user did not have to manually close the PopUp Userform when Accepting or Declining, if that's possible.

    Here is my code thus far.
    Please Login or Register  to view this content.
    Any insights are much appreciated, as always. Thanks David

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482

    Re: Userform Open Close Help

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    05-23-2014
    Location
    Fredericia, Denmark
    MS-Off Ver
    Windows Office 2013, Excel 10
    Posts
    139

    Re: Userform Open Close Help

    Can you provide more detail please?

  4. #4
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Userform Open Close Help

    dgibney, davesexcel was giving an example of how to unload a userform. We assume the "popup" is a userform? from within a userform you can use "Unload Me", if code outside the userform is to get rid of the form then the syntax is "Unload UserForm1" where UserForm1 is the actual name of the userform.

    So at the end of the code for the checkboxes just put a line of code with the unload command.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  5. #5
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482

    Re: Userform Open Close Help

    Ah, I got distracted,
    I was just replying to how to unload a userform so the user does not have to.

    I wasn't going to get into the first part of the question. Those kind of things are cool at the beginning, but tend to get very annoying quickly.

  6. #6
    Forum Contributor
    Join Date
    05-23-2014
    Location
    Fredericia, Denmark
    MS-Off Ver
    Windows Office 2013, Excel 10
    Posts
    139

    Re: Userform Open Close Help

    Thanks for your explanation. I'm still not having the results I'd like. Here is what I did based on your input:
    Please Login or Register  to view this content.
    Does anything pop out? Thanks again. David

  7. #7
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: Userform Open Close Help

    Make a copy of the project BEFORE running it, cuz you can't get the UserForm back again after clicking ACCEPT.


    Paste this code into a UserForm1 that has Checkbox 1 and Checkbox 2 :

    Please Login or Register  to view this content.

    This code goes in Sheet INSTRUCTIONS :

    Please Login or Register  to view this content.

    The code checks whether the user checks Accept or Decline. If DECLINE, the UserForm unloads and the workbook auto-closes.

    If the User checks ACCEPTS, the UserForm is deleted from the project and access to the remainder of the project continues.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Close one userform and open next one
    By lauro in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-28-2016, 04:10 AM
  2. [SOLVED] Must open and close UserForm twice for the other codes in the "Open..." Macro to execute
    By tnuis in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 09-10-2013, 09:28 AM
  3. Userform won't open with worksheet. Causing error and force close.
    By drew.j.harrison in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-30-2013, 10:51 AM
  4. [SOLVED] How to open msgBox and close UserForm if no data found
    By tuongtu3 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-12-2012, 04:45 AM
  5. How to Open 2nd workbook from userform, then close 2nd Userform
    By bigfoot007 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-04-2012, 02:03 PM
  6. close workbook and open userform
    By aman1234 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-16-2009, 06:46 AM
  7. Open Userform when you close a spreadsheet
    By nickbarthram in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 03-27-2007, 10:01 AM

Tags for this Thread

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