Object Model Reference : Classes : P : Palette : Methods : Palette.FindColor |
Function FindColor(Name As String) As Long
Member of Palette
The FindColor method finds a color by its name. If the name is found in the color palette, it returns the index number of the color in the palette; if the color is not found, it returns Nothing (0).
The following VBA example searches the active palette for Red. If the color is not found, it is added to the palette.
Sub Test() |
If ActivePalette.FindColor("Red") = 0 Then |
ActivePalette.AddColor CreateRGBColor(255, 0, 0) |
End If |
End Sub |
Copyright 2013 Corel Corporation. All rights reserved.