RGB Property

Microsoft PowerPoint Visual Basic

Show All

RGB Property

       

RGB property as it applies to the ColorFormat object.

Returns or sets the red-green-blue (RGB) value of the specified color. Read/write Long.

RGB property as it applies to the RGBColor object. 

Returns or sets the red-green-blue (RGB) value of a specified color-scheme color or extra color when used with a read/write PpColorSchemeIndex constant. The Colors method is used to return the RGBColor object.

PpColorSchemeIndex can be one of these PpColorSchemeIndex constants.
ppAccent1
ppAccent2
ppAccent3
ppBackground
ppFill
ppForeground
ppShadow
ppTitle

Example

As it applies to the ColorFormat object. 

This example sets the background color for color scheme three in the active presentation and then applies the color scheme to all slides in the presentation that are based on the slide master.

With ActivePresentation
    Set cs1 = .ColorSchemes(3)
    cs1.Colors(ppBackground).RGB = RGB(128, 128, 0)
    .SlideMaster.ColorScheme = cs1
End With

As it applies to the RGBColor object. 

This example displays the value of the red, green, and blue components of the fill forecolor for shape one on slide one in the active document.

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