Mathematica Stack Exchange is a question and answer site for users of Mathematica. 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 know that $Epilog is called when Mathematica is exited; is there a callback upon exiting the notebook? If so, what is it?

share|improve this question
up vote 12 down vote accepted

You can use NotebookEventActions for this. For example, evaluating

    NotebookEventActions -> {"WindowClose" :> CreateDocument[]}];

in your current notebook will open a new one when you close (or try to close) the window.

share|improve this answer
Excellent. Thank you. – Sean Whalen Mar 22 '13 at 2:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.