Flags Property (Color Dialog) Example, Common Dialog Control
The following example displays a Color dialog box when a command button is chosen. When the user selects a color and clicks OK, the BackColor property for a form is set.
' Declarations section Open dialog flags.
Const CC_RGBINIT = &H1&
Sub Command1_Click ()
CMDialog1.Color = &HFF& ' Set initial color selection for dialog.
CMDialog1.Flags = CC_RGBINIT
CMDialog1.Action = 3 ' Display color dialog.
Form1.BackColor = CMDialog1.Color ' Set the form's BackColor.
End Sub