ShowPickColor

<< Click to Display Table of Contents >>

 

ShowPickColor

ShowPickColor(ColorValue[, Color, Left, Top])

Opens Windows Colors dialog box to select a color. The decimal value of the selected color is returned in the ColorValue parameter. The Color parameter indicates a previously selected color on the color palette. If this parameter is not informed, assumes the value 0 (zero, black). This dialog box's position can be configured using the Left and Top parameters, which indicate, respectively, the distance from Screen's left margin and top, in pixels. In case these parameters are not informed, this dialog box is centered. The next code contains a usage example of this method.

Sub CommandButton_Click()
  Dim newColor
  Dim defaultColor
  defaultColor = 65280 ' Light green
  If Application.ShowPickColor(newColor,_
    defaultColor, 90, 90) Then
    Screen.Item("Rectangle1").ForegroundColor = newColor
    Screen.Item("Text1").Value = newColor
  End If
End Sub

Was this page useful?