Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default WorkBook Deactivate Event

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default WorkBook Deactivate Event

in the code page for ThisWorkbook

Option Explicit
Private closeflag As Boolean
Private Sub Workbook_BeforeClose(Cancel As Boolean)
closeflag = True
End Sub
Private Sub Workbook_Deactivate()
If closeflag Then
MsgBox "Closed"
Else
MsgBox "changed"
End If
End Sub


"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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing sheets after the DeActivate Event. Richard Excel Discussion (Misc queries) 2 July 10th 08 03:49 PM
Workbook Deactivate event problem Jeremy Strom Excel Programming 1 May 24th 06 11:04 PM
Activate / Deactivate mouse move event Rolo[_3_] Excel Programming 2 January 29th 04 01:50 PM
Workbook Deactivate Event TerryF[_2_] Excel Programming 1 January 6th 04 01:16 AM
Canīt Convert Formulas to Values with Deactivate event Rolo[_3_] Excel Programming 2 November 8th 03 09:13 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright Đ2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"