Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using Microsoft Excel 2007 and have several macros in my personal.xlsb workbook, which I use often, so it is very convenient that Excel opens them automatically when it starts. What I don't like is when I click on the "X" in the upper right corner of the window Excel does not exit when I close the last visible workbook. I think that this is because personal.xlsb is still open (though hidden). There are several other questions here on Superuser that have people remove personal.xlsb or move it so it doesn't open on startup (question 65297) or change settings to have only one window show in the taskbar (question 86989). (Sorry there are no hyperlinks--apparently I need more reputation to add additional hyperlinks.)

I would like to have personal.xlsb open when I open Excel, have each Excel window show in the taskbar but have Excel exit when I click the "X" on the last workbook that isn't personal.xlsb. Any thoughts on how to achieve this?

share|improve this question
up vote 2 down vote accepted

Create code for the Workbook.SheetDeactivate Event, that checks if
ActiveWorkbook.Sheets.Count =
(1 or 0, you'll have to play with this to see which works)

Then have it Close the Workbook if it's true.

share|improve this answer

You need to go to the Excel options/advanced/display and uncheck Show all windows in the taskbar

share|improve this answer

You can fix this without any code or special keystrokes by just opening an Excel document, close it, then on the blank Excel workbook, under View, unhide the Personal.xlsb. Re-hide it and close the blank workbook. It will prompt you to save the Personal.xlsb, to which you say yes, and the problem goes away.

share|improve this answer

Other "workarounds" suggested (and explained more fully) here include:

  • hold down Shift as you click the red "X"
  • add 'Exit Excel' to your 'Quick Access Toolbar'
  • use Alt+F4 to close it.
share|improve this answer
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. – Máté Juhász Nov 4 '15 at 5:32
Thanks, @MátéJuhász. This post was back in my newbie days. Have updated. – kmote Nov 4 '15 at 15:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .