Powerpoint screenupdating

28-Jun-2017 20:57 by 8 Comments

Powerpoint screenupdating

When screen updating is turned off, toolbars remain visible and Word still allows the procedure to display or retrieve information using status bar prompts, input boxes, dialog boxes, and message boxes.

' -------------------------------------------------------------------------------- ' Copyright 1999-2015, Shyam Pillai, All Rights Reserved.

You must set the Screen Updating property to True when the procedure finishes or when it stops after an error.

You can increase the speed of some procedures by keeping screen updating turned off. Insert Paragraph After End With If x Mod 50 = 0 Then Active Document.

Raise Number:=vb Object Error ERR_WINDOW_LOCK_FAIL, _ Description:="Unable to set a Power Point window lock" Exit Property End If Else ' Unlock the Window to refresh Lock Window Update (0&) Update Window (hwnd) hwnd = 0 End If End Property 'Sample Usage: Sub Long Processing Sub() ' Lock screen redraw Screen Updating=False ' --- Long time consuming code ' Redraw screen again Screen Updating=True ' Also see below article for another example of usage of the code End Sub It's fairly simple to open a Power Point file (*.ppt) for editing using VBA code however opening a Power Point Show (*.pps) file for editing is altogether another matter. Open method and it defaults to open the file in Slide Show mode. The routine below illustrates a manner of woring around the default behaviour and opening the file for editing.

The routine also illustrates the use of the Screen Updating property (code listed above).

' --------------------------------------------------------------------------------' User Defined Error codes Const ERR_NO_WINDOW_HANDLE As Long = 1000 Const ERR_WINDOW_LOCK_FAIL As Long = 1001 Const ERR_VERSION_NOT_SUPPORTED As Long = 1002 ' API declarations for Find Window() & Lock Window Update() ' Use Find Window API to locate the Power Point handle.

Declare Function Find Window Lib "user32" Alias "Find Window A" _ (By Val lp Class Name As String, _ By Val lp Window Name As Long) As Long ' Use Lock Window Update to prevent/enable window refresh Declare Function Lock Window Update Lib "user32" _ (By Val hwnd Lock As Long) As Long ' Use Update Window to force a refresh of the Power Point window Declare Function Update Window Lib "user32" (By Val hwnd As Long) As Long Property Let Screen Updating(State As Boolean) Static hwnd As Long Dim Version No As String ' Get Version Number If State = False Then Version No = Left(Application. Version, ".") - 1) ' Get handle to the main application window using Class Name Select Case Version No Case "8" ' For PPT97: hwnd = Find Window("PP97Frame Class", 0&) Case "9" ' For PPT2K: hwnd = Find Window("PP9Frame Class", 0&) Case "10" ' For XP: hwnd = Find Window("PP10Frame Class", 0&) Case "11" ' For 2003: hwnd = Find Window("PP11Frame Class", 0&) Case "12" ' For 2007: hwnd = Find Window("PP12Frame Class", 0&) Case "14" ' For 2010: hwnd = Find Window("PPTFrame Class", 0&) Case "15" ' For 2013: hwnd = Find Window("PPTFrame Class", 0&) Case Else Err.

Raise Number:=vb Object Error ERR_VERSION_NOT_SUPPORTED, _ Description:="Newer version." Exit Property End Select If h Wnd = 0 Then ' window was not found... Raise Number:=vb Object Error ERR_NO_WINDOW_HANDLE, _ Description:="Unable to get the Power Point Window handle" Exit Property End If 'Attempt to lock the window If Lock Window Update(h Wnd) = 0 Then ' attempt failed... Raise Number:=vb Object Error ERR_WINDOW_LOCK_FAIL, _ Description:="Unable to set a Power Point window lock" Exit Property End If Else 'State = True 'Unlock the Window to refresh Lock Window Update (0&) Update Window (h Wnd) h Wnd = 0 End If End Property Thanks, I was actually able to figure out this myself once I saw that the class was named "Class1" by default and not Screen Updating.

However, I still can't get it to work and when reviewing the code I can't see what should invoke the lockwindowcommand?

I added the line "Lock Window Update (0&)" after the "If Lock Window Update(hwnd) = 0"-paragraph, but I couldn't really notice a difference.

Great, now I think I kind of get the hang of how it works...still, the updating doesn't turn off. Version" where PPTApp is declared as a Power Point. So it now correctly checks the powerpoint version instead of the excel version, but the "lock window" seems to apply yo Excel still.

Presentation Dim s File Name as String Set o PPTApp = New Power Point.

  1. single dating michigan 30-Sep-2017 03:39

    These are the most popular games in the last 30 days.

  2. The web became a sexists 28-Jul-2017 00:50

    Hast du eine Lieblingsseite, bei der du willst, dass Videos abgespielt werden?

  3. transsexual web cams 25-Oct-2017 19:23

  4. dating site username 30-Oct-2017 01:12

    Sono 166 i tavoli di crisi al ministero dello Sviluppo economico, scoppiano i casi di Embraco e Ideal Standard. Il nostro speciale sui 70 anni della Costituzione Fallisce il vertice a Roma tra governo, impresa, sindacati ed enti locali per scongiurare la dismissione dell'impianto di Roccasecca (Frosinone).