+ Reply to Thread
Results 1 to 5 of 5

Disabling the Windows "Close" Button (The BIG RED 'X')

  1. #1
    Forum Contributor
    Join Date
    09-14-2012
    Location
    Tucson, Arizona, USA
    MS-Off Ver
    Office 2010
    Posts
    105

    Disabling the Windows "Close" Button (The BIG RED 'X')

    I'm trying to figure out how to disable the Windows environment 'X', as that is a coworkers favorite way to close Excel he sometimes loses data because of it.

    I use the following coding to prevent 'improper' closure of UserForms

    Please Login or Register  to view this content.
    I would like to know if there is a way to disable the 'X' that does not create a mess or cause issues in general? If it helps any, we are still using Windows XP Pro ver 2002 w/ SP3 with Office 2010, but we are slowly transitioning over to Win7 Pro, ours will be the LAST location about 6 months down the road.
    Last edited by LoneWolf3574; 10-27-2012 at 07:39 AM.

  2. #2
    Forum Contributor BeachRock's Avatar
    Join Date
    11-01-2011
    Location
    Oregon, United States
    MS-Off Ver
    Excel 2016
    Posts
    403

    Re: Disabling the Windows "Close" Button (The BIG RED 'X')

    Take a look at this.

    http://www.excelforum.com/excel-prog...se-button.html
    -------------
    Tony

  3. #3
    Forum Contributor
    Join Date
    09-14-2012
    Location
    Tucson, Arizona, USA
    MS-Off Ver
    Office 2010
    Posts
    105

    Re: Disabling the Windows "Close" Button (The BIG RED 'X')

    It mostly works, but the problem I run into is that when the portion of my macro that closes Excel runs, the message box pops up again, preventing Excel from closing.

    The code with the popup preventing Excel from closing using the windows 'X'
    Please Login or Register  to view this content.
    The code saving the workbook and trying to close Excel
    Please Login or Register  to view this content.

  4. #4
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,060

    Re: Disabling the Windows "Close" Button (The BIG RED 'X')

    I use a code provided by Leith Ross!
    see if it helps you!
    Attached Files Attached Files
    Regards, John55
    If you have issues with Code I've provided, I appreciate your feedback.
    In the event Code provided resolves your issue, please mark your Thread as SOLVED.
    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

    ...enjoy -funny parrots-

  5. #5
    Forum Contributor
    Join Date
    09-14-2012
    Location
    Tucson, Arizona, USA
    MS-Off Ver
    Office 2010
    Posts
    105

    Re: Disabling the Windows "Close" Button (The BIG RED 'X')

    I apologize for taking so long to respond on this, life in general ganged up on me real quick.

    @ john55 - I couldn't get the solution you provided to work for me, maybe it's just my noobishness to VBA, I don't know.

    I did find a solution that works best for me for another forums and feel that I should share in case anybody else wants to do this as well. The only real issue I have with it is that it must be activated every time the workbook is opened. So I just plug it into each module I want it in at the appropriate location and viola, it works for me.

    Forum & Solution

    Mind you, before the code, Sheet1 has a declaration of
    Please Login or Register  to view this content.
    I'm still working on my understanding of all this, but I'm pretty sure that is needed to make the macro work

    Please Login or Register  to view this content.
    Thank you to those who took the time to try and help me, I greatly appreciate it.

    If anybody has further suggestions, please do so within the forum guidelines.
    Last edited by LoneWolf3574; 11-16-2012 at 04:41 AM. Reason: Links

+ 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