Change Presentation ColorScheme(VBA for PowerPoint)

In this article I will explain how you can change the color scheme of a presentation using VBA for PowerPoint.

Basically each presentation has one or more slidemasters. Slides that come after each slidemaster will inherit the properties of the slidemaster. By changing the theme properties of the slidemaster you will be able to change the propeties of the following slides.

A ColorScheme has 10 different indexes to assign colors to:

  • ppAccent1
  • ppAccent2
  • ppAccent3
  • ppBackground
  • ppFill
  • ppForeGround
  • ppNotSchemecolor
  • ppShadow
  • ppTItle

By assigning different color codes to these fields you will be able to change the color scheme.  We will be using the slide below in our examples:
Original Color Scheme

Example 1

In this example the background color will be changed to blue:

Sub Example1()
Dim objDesign As Design
Dim objTempPresenation As Presentation
Set objTempPresenation = Presentations.Item(1)

objTempPresenation.SlideMaster.ColorScheme.Colors(ppBackground) = vbBlue
End Sub

Result:
Example 1

Example 2

In this example the title color will be changed to the color code 45645:

Sub Example2()
Dim objDesign As Design
Dim objTempPresenation As Presentation
Set objTempPresenation = Presentations.Item(1)

objTempPresenation.SlideMaster.ColorScheme.Colors(ppForeground) = 45645
End Sub

Result:
Result

Note: The different color schema indexes will change the color of different parts of the slidemaster for different themes. In one theme the ppBackground might change the background color while in another theme the ppFill might change the background color. You will need to play around to figure these out.

Leave a Reply

Your email address will not be published. Required fields are marked *