Multiple images export

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:

Parents Reply
  • I'm able to bring up the get folder window and run through the rest of the macro, but nothing exports to the folder location. Is the " path = " line correct? Am I doing that right? 

    For troubleshooting, you could do some checks to see what string CorelScriptTools.GetFolder is returning. You could do a similar check to see whether the string you had put together to use for the path is correct.

    One way to check those would be to simply use some message boxes to show you the strings:

    sfolder = CorelScriptTools.GetFolder("D:\Sync\Tagify\")
    MsgBox "sfolder: " & sfolder
    

    path = sfolder & groupname & "_" & i & ".png"
    MsgBox "path: " & path
    

    After you had things sorted out, you could delete or comment out the lines for the message boxes.

    Another way to check those would be to set one or more break points in the VBA editor to pause execution at a particular point, then manually "step through" execution of the code line-by-line, seeing what's going on by using the Locals window and/or the Watch window in the VBA editor.

    When I do that sort of check, I see that the string returned by CorelScriptTools.GetFolder does not include a trailing backslash. So, you will need to add one when creating the path for exporting:

    path = sfolder & "\" & groupname & "_" & i & ".png"
    
Children