How can I select all in Powerpoint VBA?

I have been struggling for a while to find a VBA code to select all the slides and all the shapes of a presentation (for some reason this seems to be of no one's interest). I have tried to set up a range with all the slides and then select all the shapes of the range, but that does not work. I also try looping slide by slide and accumulate the selection (msoFalse), but for that you also need to activate each slide and I was unable to do that. I think selecting all the slides and shapes at once is useful to manipulate the fonts or run a full spell check. Your help would be really appreciated!!

2 answers

  • answered 2022-05-04 16:46 John Korchok

    Selecting objects in VBA is generally to be avoided. It's unreliable and slow. Instead, loop through every shape on every slide and perform whatever operation you need:

    Sub DoStuffToShapes()
        Dim oSlide as Slide
        Dim oShape as Shape
        For each oSlide in ActivePresentation.Slides
            For each oShape in oSlide.Shapes
                'Do stuff to the shape
            Next oShape
        Next oSlide
    End Sub

    If you've created a font theme and applied it to the Slide Master and Layouts, it's usually easier and faster to change fonts by modifying the theme and/or master rather than using VBA. VBA isn't needed for a spellcheck either.

  • answered 2022-05-05 07:42 Olga

    Thanks for your comments! I was about to give up, you gave me the reassurance I needed.

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum