View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default WorkBook Deactivate Event

Copy the below code in 'This Workbook' and try...

Dim blnClose As Boolean
Private Sub Workbook_BeforeClose(Cancel As Boolean)
blnClose = True
End Sub

Private Sub Workbook_Deactivate()
If blnClose Then
MsgBox "Close_Deactivate"
Else
MsgBox "Deactivate"
End If
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"faffo1980" wrote:

Hi all,
The workbook Deactivate event is called when the active workbook is changed
and when the workbook is closed.
The event BeforeClosed for a workbook is called before the event Deactivate.

Is there a way to determine if the WB deactivation is caused by a Close
operation or a change operation?

Thanks

faffo1980