+ Reply to Thread
Results 1 to 4 of 4

Message box on workbook close

  1. #1
    Forum Contributor
    Join Date
    03-05-2009
    Location
    usa
    MS-Off Ver
    Excel 2016 32Bit
    Posts
    1,173

    Message box on workbook close

    How can I prevent a workbook closing if a userform is not close?.I know it will close on exit but it creates problem with the workbook syncing with dropbox.If the userform is closed before hitting the X there is no problem,if you hit the X with userform open dropbox gives you a vbaproject password box.This only happens if workbook has vba password.Have three sheets in workbook with a userform on each one,
    worksheet1 userform2
    worksheet2 userform3
    worksheet3 userform4
    Need a way to not close workbook if one of these userform are open?
    I did put unload userform2 in the before workbook close and it does close the userform but still have problems with dropbox,the userform form need closed before you click on the X

    Thanks for any input on this
    Last edited by zplugger; 08-12-2015 at 05:34 PM.

  2. #2
    Forum Contributor
    Join Date
    03-05-2009
    Location
    usa
    MS-Off Ver
    Excel 2016 32Bit
    Posts
    1,173

    Re: Message box on workbook close

    Is this going to be possible,or should I think of a different way.
    Thanks

  3. #3
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Message box on workbook close

    Hi Larry,

    Try the attached sample workbook that includes the following code. The workbook is not allowed to close if a UserForm is open.

    If you can open the UserForm in Modal mode, Excel is locked out when the UserForm is open. This prevents the 'X' from being accessed.

    Ordinary Module (e.g. Module 1) code:
    Please Login or Register  to view this content.
    ThisWorkbook module code:
    Please Login or Register  to view this content.
    UserForm1 code:
    Please Login or Register  to view this content.
    Lewis

  4. #4
    Forum Contributor
    Join Date
    03-05-2009
    Location
    usa
    MS-Off Ver
    Excel 2016 32Bit
    Posts
    1,173

    Re: Message box on workbook close

    Thank you very much,just what I was looking for.

+ 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. Copy from first workbook, close open new workbook paste close
    By johncarr1952 in forum Hello..Introduce yourself
    Replies: 2
    Last Post: 08-04-2021, 08:50 AM
  2. Opening a Workbook using a MsgBox, and opening another message box on close
    By Henk12 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-13-2015, 01:17 PM
  3. Close Active workbook after user acknowledges message box
    By jimrosser in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-29-2013, 08:44 PM
  4. Warning message. And changing data without close message.
    By pinguino in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-25-2013, 03:01 PM
  5. Disable close workbook but still force users to close thru command button
    By rathig in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-18-2013, 07:29 AM
  6. Message Box on Workbook Close
    By adam2308 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-28-2011, 09:10 AM
  7. eliminate message on workbook close
    By carsto in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-07-2007, 10:18 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