View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default 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