+ Reply to Thread
Results 1 to 2 of 2

Scope of Application.(EnableEvents | ScreenUpdating | DisplayAlerts)

Hybrid View

jakopak Scope of... 02-18-2017, 06:40 PM
kasan Re: Scope of... 02-18-2017, 07:22 PM
  1. #1
    Forum Contributor
    Join Date
    02-05-2015
    Location
    czech
    MS-Off Ver
    2010
    Posts
    172

    Scope of Application.(EnableEvents | ScreenUpdating | DisplayAlerts)

    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

  2. #2
    Valued Forum Contributor kasan's Avatar
    Join Date
    07-22-2009
    Location
    Riga, Latvia
    MS-Off Ver
    Excel 2010
    Posts
    680

    Re: Scope of Application.(EnableEvents | ScreenUpdating | DisplayAlerts)

    Hi,
    This article might be useful: https://support.microsoft.com/en-us/...dlers-in-excel

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] All in one line of code: ScreenUpdating=False, Calculation=Manua, DisplayAlerts=False
    By luv2glyd in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-13-2016, 03:10 PM
  2. Replies: 1
    Last Post: 09-30-2013, 10:56 PM
  3. [SOLVED] VBA Application.EnableEvents and Application.ScreenUpdating
    By mcmunoz in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-01-2013, 10:24 PM
  4. Application.EnableEvents
    By ilovedurango in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-19-2007, 01:19 PM
  5. Application.EnableEvents help
    By Alex in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-18-2006, 02:00 PM
  6. [SOLVED] DisplayAlerts & ScreenUpdating Properties Changing Unexpectedly
    By William Horton in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-24-2005, 05:06 PM
  7. ScreenUpdating & DisplayAlerts
    By cdb in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-04-2005, 10:06 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1