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:
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
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
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.