Previous Document Next Document

Object Model Reference : Classes : P : Palette : Methods : Palette.MatchColor


Palette.MatchColor

Function MatchColor(Color As Color) As Long

Description

Member of Palette

The MatchColor method finds the closest match for a color from the given palette.

Parameter
Description
Color
Specifies the color to match

VBA example

The following VBA example creates red by using the CMYK color model and then converts the color to an RGB color. The MatchColor method then finds the closest match from the active palette and displays the name of that color.

Sub TestPalette()
 Dim pal As Palette
 Dim cColor As Color
 Dim i As Integer
 Set pal = ActivePalette
 Set cColor = CreateCMYKColor(0, 100, 100, 0) 'Red
 cColor.ConvertToRGB
 i = pal.MatchColor(cColor)
 MsgBox pal.Color(i).Name
End Sub

Previous Document Next Document Back to Top

Copyright 2013 Corel Corporation. All rights reserved.