When I''m designing in CorelDRAW (2017) I always end up grouping stuff together.For example, I always design symbols in CorelDraw and group the individual objects in one group, so I can copy them and change the color.
Now rather than export each individual symbol (group), I really want a macro which exports each selected symbol (group) as a PNG file with the file name the same as the group name.For example I have 5 symbols (groups) named: group1, group2, group3, group4, group5.And when I select only the first 3, I want to run a macro that exports each of those groups as an individual png file with the groupname as the file name (group1.png, group2.png and group3.png).
So far I can loop through each selected group and get the name.But now I need to export each of them as an image (png).
It seems I'm unable to do that.I''m only able to export all the selected group as one single image.
I use the 'Shape' object (Visual Basic) for each of the groups.Is there a way to export that 'Shape' object?
See my code below:
try code below
Sub exportGroups()Dim groups As ShapeRangeDim group As ShapeDim groupname As String, path As StringSet groups = ActiveSelectionRange
For i = 1 To groups.Countgroupname = groups.Shapes(i).Namegroups.Shapes(i).CreateSelectionpath = "c:\" & groupname & ".png"Set expflt = ActiveDocument.ExportBitmap(path, cdrPNG, cdrSelection, cdrRGBColorImage, 0, 0, 300, 300, cdrNormalAntiAliasing, False, True, True, False, cdrCompressionNone)With expflt.interlaced = True.Transparency = 0.invertmask = False.Color = 0.FinishEnd WithNext iEnd Sub
Thank you very much.I tested it out and needed some adjusmtents (different path).
But it end up working perfectly.I really appreciate your support, thanks!
You are welcome.