How to fill a shape with a Pantone color using VBA

OK, I'm trying to do a very simple thing but the way to do it is eluding me. I just want to fill a shape with a Pantone color using a macro. Just one color from the basic Pantone coated palette (not Pantone+ or anything). I can't figure out the way to correctly identify the palette and color in a way that CorelDraw will recognize. Any help will be greatly appreciated.

Ric

Parents
No Data
Reply
  • There may be a more elegant way to get there than this, but this might help you get going:

    Sub demonstrate_specifying_Pantone_color()
    Dim palThis As Palette
    Dim lngIndexOfColor As Long
    Dim colThis As Color
    Const strPaletteName As String = "PANTONE® solid coated"
    Const strColorName As String = "PANTONE Hexachrome Cyan C"
    
        Set palThis = Application.PaletteManager.GetPalette(strPaletteName)
        lngIndexOfColor = palThis.FindColor(strColorName)
        Set colThis = palThis.Color(lngIndexOfColor)
        
        ActiveShape.Fill.ApplyUniformFill colThis
    
    End Sub
    

    If I needed to do that very much, I would wrap things up in a function - with some error handling! - so that I could supply the palette name and color name, and have it return the color.

Children