ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Event when workbook is saved or closed (https://www.excelbanter.com/excel-discussion-misc-queries/77714-event-when-workbook-saved-closed.html)

tk

Event when workbook is saved or closed
 
Is there an event that fires when a workbook is saved or closed. I have
tried adding workbook_save and workbook_close functions (to the thisworkbook
object), but the code that I put in never fires. The workbook_open seems to
work ok. I am using Excel 2003.

Thanks,



vezerid

Event when workbook is saved or closed
 
Workbook_BeforeSave
Workbook_BeforeClose

If you are at the ThisWorkbook's code page, you will see at the top of
the window two drop-down boxes. At first, in an empty module, the left
one says: (General). If you choose ThisWorkbook instead, then the right
box will contain all the workbook-level event procedures.

HTH
Kostis Vezerides


Thunder

Event when workbook is saved or closed
 

"tk" ha scritto nel messaggio
...
Is there an event that fires when a workbook is saved or closed. I have
tried adding workbook_save and workbook_close functions (to the

thisworkbook
object), but the code that I put in never fires. The workbook_open seems

to
work ok. I am using Excel 2003.

Thanks,



I don't understand. I have the following code and work fine:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
MsgBox ("Your Workbook is in order to be closed")
End Sub

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
MsgBox ("Your Workbook is in order to be saved")
End Sub

--
Ciao
Thunder





All times are GMT +1. The time now is 01:16 PM.

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