View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jeff Harbin[_2_] Jeff Harbin[_2_] is offline
external usenet poster
 
Posts: 16
Default Closing a workbook...

I've written some code in the Workbook_BeforeClose( ) routine. It basically
clears and resets values in a spreadsheet before closing and the last line
of the subroutine is a Workbook.Save command (or something like that) and it
saves the changes without prompting me if I want to save them.

Up until now it's working perfectly but I've been using the 'x' from the
upper right hand corner of the window. Now I'm trying to create a custom
menu with an Exit command to use that to close the workbook in place of the
Close window command, 'x'.

I've coded the routine as follows:

Sub mcrShutDown ( )

ThisWorkbook.Saved = True
Application.Workbook.Close

End Sub

There are 2 problems: 1) I'm getting prompted to save changes and 2) it's
not running the Workbook_BeforeClose routine so my program doesn't get
reset.

What am I missing? How come the Workbook_BeforeClose routine isn't running?

Jeff