vbapowerpointvisual-studio-macros

Making a macro to generate a custom show in Powerpoint


I want to make a macro for PowerPoint, to generate a custom show, containing all the slides from my PowerPoint but in random order. How would I do this? I want to be able to run it and create different custom shows each time.

It's been 3 years since I used PowerPoint, and the only experience I have with VB was a little bit of VB6 in 2004.


Solution

  • Check out the info here.

    Sample:

    Sub sort_rand()
    
        Dim i As Integer
        Dim myvalue As Integer
        Dim islides As Integer
        islides = ActivePresentation.Slides.Count
        For i = 1 To ActivePresentation.Slides.Count
            myvalue = Int((i * Rnd) + 1)
            ActiveWindow.ViewType = ppViewSlideSorter
            ActivePresentation.Slides(myvalue).Select
            ActiveWindow.Selection.Cut
            ActivePresentation.Slides(islides - 1).Select
            ActiveWindow.View.Paste
        Next
    
    End Sub