API Documentation > CorelDRAW > 2025-v26 > Palette > IVGPalette
Palette.MatchColor method
Finds the closest match for the color from the given palette
Syntax:
Function MatchColor(ByVal Color As Color) As Long
Parameters:
Name Type Description
Color
Remarks:
The MatchColor method finds the closest match for a color from the given palette.
Examples:
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