Hi guys! Anybody got any experience with Visual Basic for Applications, especially concerning macros in CorelDraw? I am a linux guy through and through, so I am a bit clueless about VB. I'm trying to write a macro that would check the whole document for a shade of blue in CMYK and change it into another shade of blue in CMYK. I managed to do it with fills and outlines, but can't find anything on searching and changing colors in fountain fills.
This is my code so far:
Function FindAllShapes() As ShapeRange
Dim s As Shape
Dim srPowerClipped As New ShapeRange
Dim sr As ShapeRange, srAll As New ShapeRangeIf ActiveSelection.Shapes.Count > 0 Then Set sr = ActiveSelection.Shapes.FindShapes() Else Set sr = ActivePage.Shapes.FindShapes() End If Do For Each s In sr.Shapes.FindShapes(Query:="[email protected]") srPowerClipped.AddRange s.PowerClip.Shapes.FindShapes() Next s srAll.AddRange sr sr.RemoveAll sr.AddRange srPowerClipped srPowerClipped.RemoveAll Loop Until sr.Count = 0 Set FindAllShapes = srAllEnd Function
Sub FixBlue()
Dim srFill As ShapeRange
Dim srOutline As ShapeRange
Dim srFountain As ShapeRangeSet srFill = FindAllShapes.Shapes.FindShapes(Query:="@fill.color.cmyk[.c=89 and .m=63 and .y=0 and .k=0]") Set srOutline = FindAllShapes.Shapes.FindShapes(Query:="@outline.color.cmyk[.c=89 and .m=63 and .y=0 and .k=0]") srFill.ApplyUniformFill CreateCMYKColor(100, 68, 0, 2) srOutline.SetOutlineProperties Color:=CreateCMYKColor(100, 68, 0, 2)End Sub
Before you say something, yes I know there is find and replace function in Corel. I simply need to automate multiple (10+) color replacements at the opening of every .cdr file in Corel.