+ Reply to Thread
Results 1 to 7 of 7

Disable X Button of Excel Application

  1. #1
    Forum Contributor
    Join Date
    09-18-2014
    Location
    Pakistan
    MS-Off Ver
    2013, 2016
    Posts
    283

    Disable X Button of Excel Application

    Hi everyone!

    I hope you all are fine and doing well in excel.

    Here I need your help regarding Excel Close Button.

    I want to disable X button of Excel Application.

    File is attached as example

    Please give me any solution.

    Thank you so much
    Attached Files Attached Files

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

    Re: Disable X Button of Excel Application

    Not exactly the X on the application per se, but have you tried using the workbook close event?
    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.

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

    Re: Disable X Button of Excel Application

    Hi AmirSoft,

    See the attached copy of your workbook. Code follows here:

    Ordinary Module Code:
    Please Login or Register  to view this content.
    UserForm Code:
    Please Login or Register  to view this content.
    ThisWorkBook Code:
    Please Login or Register  to view this content.
    Lewis

  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: Disable X Button of Excel Application

    LJMetzger,
    I'll try to copy/paste your code, but earlier today I tried over and over with the beforeclose event, and no matter what I tried, it was still closing. Yes I put a stop, and then stepped through, cancel was set to true, and it simply closed the application anyhow. I thought it was an easy one to answer, but simply could not get the close to cancel no matter what I tried.
    P.S. Tried it now, I get the message, but it just closed. Any thoughts on what is going on?

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

    Re: Disable X Button of Excel Application

    I thought it was an easy one to answer
    There are no easy answers with Excel.

    I had problems too until I moved 'Application.Quit' into Worksheet_BeforeClose().

    I suggest you download my file, and see if it works for you. Then try the cut and paste.

    Lewis

  6. #6
    Forum Contributor
    Join Date
    09-18-2014
    Location
    Pakistan
    MS-Off Ver
    2013, 2016
    Posts
    283

    Re: Disable X Button of Excel Application

    LJMetzger Thanks

    You did it.

  7. #7
    Forum Contributor
    Join Date
    09-18-2014
    Location
    Pakistan
    MS-Off Ver
    2013, 2016
    Posts
    283

    Re: Disable X Button of Excel Application

    Thank You so much.

+ 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] Excel VBA - Disable Command button in sub?
    By kickme93 in forum Excel Programming / VBA / Macros
    Replies: 27
    Last Post: 12-10-2013, 08:27 AM
  2. Disable button in excel using VBA
    By kailassingh in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-14-2013, 12:40 PM
  3. Disable the big X red button of Excel
    By Nicholas1978 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-17-2012, 02:49 PM
  4. [SOLVED] Disable X button in excel
    By giant in forum Excel General
    Replies: 2
    Last Post: 04-19-2012, 05:16 PM
  5. Disable the "X" close button in an excel application
    By Tempy in forum Excel Programming / VBA / Macros
    Replies: 22
    Last Post: 04-19-2005, 11:06 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