ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   disable closing of workbook (https://www.excelbanter.com/excel-programming/368523-disable-closing-workbook.html)

Varun Nair

disable closing of workbook
 
Hi

I want a code that could save the workbook if the user closes it!
--
Varun Nair


Tom Ogilvy

disable closing of workbook
 
Private Sub Workbook_BeforeClose(Cancel As Boolean)
thisworkbook.Save
End Sub

this would go in the Thisworkbook module of the workbook.

Chip Pearson's page on events if you are not familiar:
http://www.cpearson.com/excel/events.htm

--
Regards,
Tom Ogilvy



"Varun Nair" wrote:

Hi

I want a code that could save the workbook if the user closes it!
--
Varun Nair



All times are GMT +1. The time now is 12:57 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com