Slide transition effects fail in a vba controlled PowerPoint presentation

75 Views Asked by At

I am runnig PowerPoint presentations with PP 2016 on 64-bit Win10 and Win11 PCs, which are cotrolled by Visual Basic for Application (vba) code. The code changes the slide content, e.g. visibility, colour and text content of shapes and initiates slide trasitions using Application.ActivePresentation.SlideShowWindow.View.GotoSlide (Slide_no). All slides have transition effects set, e.g. ppEffectVortexRight.

If the presentation is started, the transition effects work fine for the first time. However, once the vba code has changed some slide content and switches slides for a second time, the transition effect will display a previous version of the exited and the entered slides during the animation.

This means, the vba-made changes on the exited slide will suddenly disappear at the start of the animation, which then morphs into an old version of the target slide that finally changes to its modified version instantly once the animation has finished. It looks like PowerPoint is generating the animation sequence during the first run and is reusing the old sequence again later regardless of the fact that slides have been modified by my vba code.

I've tried some workarounds, e.g. changing the type of the transition effects to ppEffectNone and then back to ppEffectVortexRight or adding shapes via vba before swithing slides but I have not been successfull. The occurance of the described failure is a little unpredictable, however it never occurs during the first run of a slide transition.

Is there a way to force Powerpoint to recreate the transition effect animations while the presentation is running?

Thanks for any support! Best regards, Georg

EDIT1: Here is some example code that will fail on my PC:

   ' this transition will work fine
   Application.ActivePresentation.SlideShowWindow.View.GotoSlide (2)
   Call AppWait(8)
   ' this transition will work fine
   Application.ActivePresentation.SlideShowWindow.View.GotoSlide (3)
   Call AppWait(8)
   'change text on slide 2 and swith to this slide. The transition animation will show the original text on slide 2
   Application.ActivePresentation.Slides(2).Shapes("TextRect1").TextFrame.TextRange = "TEXT MODIFIED BY VBA"
   Application.ActivePresentation.SlideShowWindow.View.GotoSlide (2)
   Call AppWait(8)
   'change text on slide 3 and swith to this slide. The transition animation will show the original text on both slide 2 and slide 3
   Application.ActivePresentation.Slides(3).Shapes("TextRect1").TextFrame.TextRange = "TEXT MODIFIED BY VBA"
   Application.ActivePresentation.SlideShowWindow.View.GotoSlide (3)
   Call AppWait(8)

You con downlaod a PPTM with this code from https://filetransfer.io/data-package/54PCMfJP#link

0

There are 0 best solutions below