Hello Dear Excel Help Forum
I have tested how is status of Appplication.method retained after runtime:
EnableEvents 'is retained
ScreenUpdating 'reset back to deafault:True
DisplayAlerts 'reset back to deafault:True
I wold like to use following procedure to set all 3 methods to False.
I wonder what is the scope of this procedure? Like when the procedure is called from another module or the procedure is deeply nested in another procedure? Does each level of procedure has its own states are ther are only global states?
Sub allowEvents(st As Boolean)
If st = False Then
' Sticks after runtime
Application.EnableEvents = False 'dissable events from trigerring (like sheet_change)
'Reset at the end of runtime
Application.ScreenUpdating = False
Application.DisplayAlerts = False 'no user asking prompts '
ElseIf st = True Then
' Sticks after runtime
Application.EnableEvents = True 'dissable events from trigerring (like sheet_change)
'Reset at the end of runtime
Application.ScreenUpdating = True
Application.DisplayAlerts = True 'no user asking prompts '
End If
End Sub
Bookmarks