Hallo,
I often have plans where all shapes on the same Layer.
It is not very funny to sort this
Until now I work with function "search and find", make groups an layers.
So the idea was to write a Macro.
For this project I have found different Macros, they are working good:
Sub ungroup() ActivePage.Shapes.All.CreateSelection Dim s1 As Shape Set s1 = ActiveSelection.Group Dim grp1 As ShapeRange Set grp1 = s1.UngroupAllEx ActiveDocument.ClearSelectionEnd Sub
Sub findBitmaps()Set sr = ActivePage.Shapes.FindShapes(Type:=cdrBitmapShape)sr.deleteEnd Sub
Sub Fill()Dim lr1 As LayerDim s As ShapeFor Each s In ActivePage.ShapesIf s.Fill.Type = cdrUniformFill Thens.AddToSelectionEnd IfNext sActiveSelection.Group.CutSet lr1 = ActivePage.CreateLayer("Fill")CorelScript.PasteFromClipboardEnd Sub
Sub Outline()Dim lr1 As LayerSet lr1 = ActivePage.CreateLayer("255_0_0")Set sr = ActivePage.Shapes.FindShapes(Query:="@outline.color = RGB(255, 0, 0)")sr.GroupEnd Sub
Furthermore I have found the manual function to take colours from a document into a new palette.
Now I have two problems:
- How could I search outline for every Colour which is used in the document (different in every document) ?
- How could I put the parts together, that the macro still work
Thank you for help
The following will look at your Current Selection and Move each Outline Color to its own layer.
Sub OutlinesToLayers() Dim srSelection As ShapeRange, srOutlines As ShapeRange, srFound As ShapeRange Dim c As Color Dim s As Shape Dim l As Layer Set srSelection = ActiveSelectionRange Set srOutlines = srSelection.Shapes.FindShapes(Query:="@outline.type <> 'none'") Do Set s = srOutlines.FirstShape Set c = s.Outline.Color c.ConvertToRGB Set l = ActivePage.CreateLayer(c.RGBRed & "_" & c.RGBGreen & "_" & c.RGBBlue) Set srFound = srOutlines.Shapes.FindShapes(Query:="@outline.color = '" & c.ToString & "'") srFound.Group srFound.MoveToLayer l srOutlines.RemoveRange srFound Loop Until srOutlines.Shapes.Count = 0 End Sub
Hope that helps,
-Shelby