Powerpoint macro screenupdating

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

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

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 hwnd = 0 Then Err.

Close Call create_Slide8(slides Count, pp Pres) slides Count = pp Pres.

Cut Copy Mode = False Call create_Slide9(slides Count, pp Pres) slides Count = pp Pres.

Shape Dim Slide Number As String On Error Resume Next Set ppt App = New Power Point.

My powerpoint is going to be about 25 slides and its already crashing past slide 7. I have added in the 3 basic layouts for each Macro I use and slides 8 and 9 of where it crashes.

Screen Updating is turned on outside of the procedure.

- Try this at the beginning of your procedure: Application.

I’ve seen the threads on this subject that recommend “fiddling with the code” or “calling the code in a subroutine”.

Unfortunately, I have to maintain hundreds of Excel applications each with thousands of lines of code and hundreds of users who are about to migrate to Office 2016, so rewriting is not an option. I wanted to leave a comment but I am not allowed to do so.

Leave a Reply