TransWikia.com

Macro to change PowerPoint Presentation slides with random background colors

Super User Asked by NotepadPlusPlus PRO on November 7, 2021

Is there a macro that can change the PowerPoint slides to have random background colors? I have looked for the PowerPoint themes, but usually they have few colors scheme.

I am looking for a way to automatically apply random background colors to existing PowerPoint slides?

Here is an example:

enter image description here

Nice to Have:

  • It would be nice to have a control over sequence of colors to pick from.

Note:

  • I can manually change individual background colors. But that is not the intent of this question.

One Answer

You can try the code below. It loops through the slides and changes their background colors. The colors are selected randomly for each slide.

Note: When testing, I noticed that I had to change the slides' background color from white to another color for a slide to start changing its color. I advise you do the same.

Sub SetRandomBackground()

    Dim x, red, blue, green As Integer
    Dim myslide As Slide

    For Each myslide In ActivePresentation.Slides
       
            red = Int((255 * Rnd) + 1)
            blue = Int((255 * Rnd) + 1)
            green = Int((255 * Rnd) + 1)
            myslide.Background.Fill.ForeColor.RGB = RGB(red, green, blue)

    Next

End Sub

IMG:

Answered by Reddy Lutonadio on November 7, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP