Closing Excel from a Macro


Posted by Domino Pateman on November 20, 2001 4:03 AM

Hi.

I'm doing a project in Excel at the moment, but there are still a few bits that I would like to perfect to do with closing Excel from a Macro. I have disenabled the x in the top corner, and when clicked it brings up a message box to tell you to go to the main page and close excel fromthe macro there (this is so that the user cannot ever close the workbook without saving the changes.) However, once they have clicked on this button on the main page to close the workbook, all it does is brings up the same msg box as before, so its a bit of a loop. Can anyone help me? I'm sorry that I can't explain myself very well.

Posted by Ben O. on November 20, 2001 5:58 AM

Two ideas:

1) In your code, you could re-enable the Exit button right before your Application.Quit statement.

2) Instead of disabling the exit button, add a Workbook_BeforeClose event that saves the workbook before the user closes it.

-Ben



Posted by JO on November 20, 2001 7:19 AM

Maybe if you sent your full code here , somebody
can help you..but its up to you..coz the problem
is not so clear