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

Hi all,

EnableEvents = false and EnableEvents = true need to be paired ? Similiar
issue are ScreenUpdating,DisplayAlerts.

Clara
--
thank you so much for your help
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default EnableEvents

Hi Clara

EnableEvents = false and EnableEvents = true need to be paired ? Similiar
issue are ScreenUpdating,DisplayAlerts.


Normally, yes!

More generally, changes which are made to application
settings should normally be reversed by your code when
no longer required.

It is often therefore, advisable to restore application settings
to their previous state in an error handler; in this way any
error in the code will not prevent the desired restoration of
the previous settings. An example might be:

'================
Public Sub Tester()
Dim CalcMode As Long

On Error GoTo XIT
With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With

'Your code

XIT:
With Application
.Calculation = CalcMode
.ScreenUpdating = True
End With
End Sub
'<<================


---
Regards,
Norman


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 252
Default EnableEvents

Hi Norman, thank you very much!

Clara
--
thank you so much for your help


"Norman Jones" wrote:

Hi Clara

EnableEvents = false and EnableEvents = true need to be paired ? Similiar
issue are ScreenUpdating,DisplayAlerts.


Normally, yes!

More generally, changes which are made to application
settings should normally be reversed by your code when
no longer required.

It is often therefore, advisable to restore application settings
to their previous state in an error handler; in this way any
error in the code will not prevent the desired restoration of
the previous settings. An example might be:

'================
Public Sub Tester()
Dim CalcMode As Long

On Error GoTo XIT
With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With

'Your code

XIT:
With Application
.Calculation = CalcMode
.ScreenUpdating = True
End With
End Sub
'<<================


---
Regards,
Norman



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
EnableEvents doesn't work Stefi Excel Programming 7 April 5th 07 02:30 PM
Application.EnableEvents WLMPilot Excel Programming 2 November 27th 06 04:48 AM
Application.EnableEvents help Alex Excel Programming 4 August 18th 06 06:57 PM
EnableEvents BeforeClose Stefi Excel Programming 2 November 16th 05 09:22 AM
application.EnableEvents nc Excel Discussion (Misc queries) 1 September 28th 05 04:00 PM


All times are GMT +1. The time now is 10:08 AM.

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

About Us

"It's about Microsoft Excel"