Powerpoint 2016 screenupdating

' --------------------------------------------------------------------------------' 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.

I want to start off this post by thanking everyone who sent in their examples in response to my January request.

powerpoint 2016 screenupdating-87powerpoint 2016 screenupdating-84powerpoint 2016 screenupdating-22

' -------------------------------------------------------------------------------- ' You are free to use this code within your own applications, add-ins, ' documents etc but you are expressly forbidden from selling or ' otherwise distributing this source code without prior consent.

' This includes both posting free demo projects made from this ' code as well as reproducing the code in text or html format.

This example turns off screen updating and then adds a new document.

Five hundred lines of text are added to the document.

Learn how to insert MS word tables into a slide and how to manipulate the native Power Point table shape.

The native table shape is supported only with Power Point version 2000 and above.

At every fiftieth line, the macro selects the line and refreshes the screen.

Excel & Word have the Screen Updating method thru which a developer can lock the main window from unnecessarily redrawing itself whilst the macro is being executed. If left alone, redrawing is not only ugly on the eyes it also takes more time for the macro to reach completion.

There are tons of sites, pages, and people who are experts as well on this subject, have performed their own tests, and shared their results and ideas.

Tags: , ,