Class RGBColor (PowerPoint VBA)

The class RGBColor represents a single color in a color scheme.


To use a RGBColor class variable it first needs to be instantiated, for example

Dim rgb as RGBColor
Set rgb = ActivePresentation.ColorSchemes(1).Colors(SchemeColor:=ppAccent1)

RGBColor class variables can be set using the ColorScheme.Colors procedure.


Returns the parent object for the specified object.


Returns or sets the red-green-blue (RGB) value of a specified color-scheme color or extra color when used with a PpColorSchemeIndex constant.

Use the Colors method to return a RGBColor object. The value of the RGB property can be one of these PpColorSchemeIndex constants.

Set myDocument = ActivePresentation.Slides(1)
c = myDocument.Shapes(1).Fill.ForeColor.RGB
redComponent = c Mod 256
greenComponent = c \ 256 Mod 256
blueComponent = c \ 65536 Mod 256
MsgBox "RGB components: " & redComponent & _
    ", " & greenComponent & ", " & blueComponent