The Color dialog box enables a user to select a color from a palette of standard colors and custom colors. The Color dialog box also enables a user to define new custom colors.
The Color dialog box uses the Color and Flags properties. You can set these properties to provide a default color and to enable or disable the creation of custom colors.
The following code example shows how to display a Color common dialog box and return the selected color.
Public Function GetNewColor()
'Set the default color
CommonDialog1.Color = vbRed
'Use the default color in the dialog
'And open the custom colors panel
CommonDialog1.Flags = cdlCCRGBInit + cdlCCFullOpen
'Show the Color common dialog box
CommonDialog1.ShowColor
'Return the color that the user selected, or
'the default color if the user canceled the dialog
GetNewColor = CommonDialog1.Color
End Function