Macro to change outline color to Custom Spot Color palette

Hi i have this macro below

Sub Macro1()
    ' Recorded 03/11/2015
    ActiveLayer.Shapes(1).Outline.SetProperties Color:=CreateCMYKColor(0, 100, 100, 0)
End Sub

i am trying to change the outline color of a object but using a macro.But the color im trying to get it to change to is a Custom Spot Color .I want the macro to use a color name exactly from the Custom Spot Color palette . I can easily add the color to the default palette but this is not a option as has to be direct from the Custom Spot Color palette.How is this possible please ive tried recording many times.Maybe is just need editing like this below .

Sub Macro1()
    ' Recorded 03/11/2015
    ActiveLayer.Shapes(1).Outline.SetProperties Color:=CreateSpotColor(0, 100, 100, 0)
End Sub

Parents
  • Steve,

    For my examples I have created a custom palette named, SamplePalette.xml with a single Spot Color I have named, MySpotColor.

    The easiest way to do what you want would be to use CreateSpotColorByName:

        Dim c As Color
        
        Set c = CreateSpotColorByName("SamplePalette.xml", "MySpotColor")
        ActiveShape.Outline.Color = c
    

    But it never seems to work for me, so lets try a couple others. You could get your palette, then find the color by name in your palette like this:

        Dim c As Color
        Dim p As Palette
        Dim lngColorIndex
        
        Set p = PaletteManager.GetPalette("SamplePalette.xml")
        lngColorIndex = p.FindColor("MySpotColor")
        Set c = p.Color(lngColorIndex)
        
        ActiveShape.Outline.Color = c
    

    And of course if you know the index of your color in your palette you could simplify do this:

        Dim c As Color
        
        Set c = CreateSpotColor("SamplePalette.xml", 1)
        ActiveShape.Outline.Color = c
    

    Hopefully that helps,

    -Shelby

Reply Children