WorkbookBeforeClose Event

See Also         Example         Applies To

Occurs immediately before any open workbook closes.

Syntax

Private Sub object_WorkbookBeforeClose(ByVal Wb As Workbook, ByVal Cancel As Boolean)

object   An object of type Application declared with events in a class module. For more information, see Using Events with the Application Object.

Wb   The workbook that's being closed.

Cancel   False when the event occurs. If the event procedure sets this argument to True, the workbook doesn't close when the procedure is finished.