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
You can try to use code below, your spot colors are stored in the palette „testpalette.xml“, 0 is the ID of the spot color, 100 is the tont of the spot color
Sub outline()
Dim OS As ShapeRange
Set OS = ActiveSelectionRange
OS.SetOutlineProperties Color:=CreateSpotColor(("testpalette.xml"), 0, 100)
End Sub
Best regards,
Mek
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