+ Reply to Thread
Results 1 to 10 of 10

Make a loop for disable closing the UserForm

  1. #1
    Registered User
    Join Date
    08-13-2012
    Location
    Slovenia
    MS-Off Ver
    Excel 2010
    Posts
    72

    Make a loop for disable closing the UserForm

    Hi to all,

    How are you? I think my question is very easy today ok... i have below code for prevent to close a user form:

    Please Login or Register  to view this content.
    But this work to me only one time, when i make a second press on close button user form close ;(
    I think i have to make a loop or something but i really don't now how?

    Thank you for help!
    Last edited by zeko90; 06-04-2014 at 05:20 AM. Reason: like this is better!

  2. #2
    Registered User
    Join Date
    08-13-2012
    Location
    Slovenia
    MS-Off Ver
    Excel 2010
    Posts
    72

    Re: Make a loop for disable closing the UserForm

    Like this ?


    Please Login or Register  to view this content.
    Last edited by zeko90; 06-04-2014 at 04:57 AM.

  3. #3
    Registered User
    Join Date
    08-13-2012
    Location
    Slovenia
    MS-Off Ver
    Excel 2010
    Posts
    72

    Re: Make a loop for disable closing the UserForm

    Ohhh i see it
    now is cool

  4. #4
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Make a loop for disable closing the UserForm

    'Place this code in a Module

    Please Login or Register  to view this content.


    'Place this code in a UserForm with one Command Button named CommandButton1.

    Please Login or Register  to view this content.
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  5. #5
    Registered User
    Join Date
    08-13-2012
    Location
    Slovenia
    MS-Off Ver
    Excel 2010
    Posts
    72

    Re: Make a loop for disable closing the UserForm

    Works great

  6. #6
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Make a loop for disable closing the UserForm

    Be sure that you'll read the forum rules for the next time..!

  7. #7
    Registered User
    Join Date
    08-13-2012
    Location
    Slovenia
    MS-Off Ver
    Excel 2010
    Posts
    72

    Re: Make a loop for disable closing the UserForm

    Now i make more tests and see that still not working like i want it...

    I have user form Log in and this all work great but problems is when i press X button on top user form, than user form close.

    User form:
    Please Login or Register  to view this content.

    And when i add this (below) work just for one press
    Please Login or Register  to view this content.
    I hope that you understand what i want

    I want that you can open excel just with password end press on ENTER button

  8. #8
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Make a loop for disable closing the UserForm

    Sorry but now i don't understand..Perhaps if i'll have a sample workbook.

  9. #9
    Registered User
    Join Date
    08-13-2012
    Location
    Slovenia
    MS-Off Ver
    Excel 2010
    Posts
    72

    Re: Make a loop for disable closing the UserForm

    Ok, sorry for that my English is not so good...

    I have user form (log in, protected with password)

    When you open excel user form pop it out and ask you for USERNAME AND PASSWORD

    on user form i have two boxes when you can write user name and password

    Than i have two buttons one is for "OK" when you enter code and press it to go true.. and another is quit application (EXCEL)...

    now only problem i have is that user form have in upper right corner an X with this i can close the user form and jump it away from password

    I want to add that when you press that X user form will not close but just remind you that you can't close it

    but look i already do something like that but works only one time... wehen i press it again on x button user form close.

    Please find in attachment my example
    Attached Files Attached Files

  10. #10
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Make a loop for disable closing the UserForm

    Adding this looks that is ok.


    Please Login or Register  to view this content.
    Attached Files Attached Files

  11. #11
    Forum Contributor
    Join Date
    03-29-2012
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    818

    Re: Make a loop for disable closing the UserForm

    Please Login or Register  to view this content.
    Sorry Fotis just looked at your code and it does the same thing
    Last edited by Excelnoub; 06-04-2014 at 07:32 AM.

+ 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. [SOLVED] Disable Closing Of Workbook Until Cells Receive Data
    By swordswinger710 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-08-2012, 03:05 PM
  2. Keep Modal UserForm Alive after closing 2nd userform using 2007?
    By ShredDude in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-24-2008, 03:12 PM
  3. disable closing of workbook
    By Varun Nair in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-27-2006, 08:55 AM
  4. [SOLVED] how to disable save prompt on closing excel file in automated mode
    By vipag@yahoo.com in forum Excel General
    Replies: 3
    Last Post: 07-06-2005, 06:05 PM
  5. Disable closing workbook
    By Edcel in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-10-2005, 04:26 AM

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