ColorFormat.RGB property (Word)
Returns or sets the red-green-blue (RGB) value of the specified color. Read/write Long.
Syntax
expression. RGB
expression A variable that represents a 'ColorFormat' object.
Example
This example sets the color of the second shape in the active document to gray.
ActiveDocument.Shapes(2).Fill.ForeColor.RGB = RGB(128, 128, 128)
This example sets the color of the shadow for Rectangle 1 in the active document to blue.
ActiveDocument.Shapes("Rectangle 1").Shadow.ForeColor.RGB = _
RGB(0, 0, 255)
This example returns the value of the foreground color of the first shape in the active document.
MsgBox ActiveDocument.Shapes(1).Fill.ForeColor.RGB
See also
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for