T
tempest0123
Hi all.
I am having trouble figuring out a strange behavior with the
Workbook_BeforeClose event procedure.
Suppose I have a Workbook_BeforeClose event procedure that makes some
changes to some worksheets and then save the workbook before closing.
The changes made by the event procedure would be saved only if the
workbook is closed manually in Excel by a user.
However, if the workbook is opened and then closed by an external VB
program using Excel application object, changes made by the
Workbook_BeforeClose event procedure are NOT saved. In fact, the
modification date/time of the Workbook file remains unchanged.
To make sure the Workbook_BeforeClose ran if the workbook was closed
by the external program, I placed several MsgBox statements in the
Workbook_BeforeClose event procedure. And sure enough all the MsgBox
messages were displayed, but changes were not saved.
Does anyone know what is going on here with the Workbook_BeforeClose
event?
Thanks.
Jason
I am having trouble figuring out a strange behavior with the
Workbook_BeforeClose event procedure.
Suppose I have a Workbook_BeforeClose event procedure that makes some
changes to some worksheets and then save the workbook before closing.
The changes made by the event procedure would be saved only if the
workbook is closed manually in Excel by a user.
However, if the workbook is opened and then closed by an external VB
program using Excel application object, changes made by the
Workbook_BeforeClose event procedure are NOT saved. In fact, the
modification date/time of the Workbook file remains unchanged.
To make sure the Workbook_BeforeClose ran if the workbook was closed
by the external program, I placed several MsgBox statements in the
Workbook_BeforeClose event procedure. And sure enough all the MsgBox
messages were displayed, but changes were not saved.
Does anyone know what is going on here with the Workbook_BeforeClose
event?
Thanks.
Jason