Sometimes I need to create bleeds and cutlines for various objects that are to be digitally printed and then cut using a plotter. It's not really my field but I can manage. Anyway, with the most basic artworks, or at least artworks that have a single outline or fill colour, the process goes as follows:
This becomes tedious very quickly. I need an automated solution.
Last year I tried recording a macro using more or less these steps, but I could not figure out how to point the macro to any given object. As far as I remember, it would just use the size and colour properties of whichever object was used to record the macro, so it was not dynamic.
So I have two questions:
First off, is there an outright easier way to achieve what I'm doing?
If not, how do I make the macro be more generic in its targeting? In other words, fetch and apply properties from the currently selected object instead?
Thank you.
Bleed_example.zipNeeded to zip it for some reason. Herein is a side by side comparison of what I need.
Thanks. It helps a lot to see exactly the sort of content you are working with.
For the example content you posted, you could try this:
Sub ThreecubeMike_01()Dim sOriginal As ShapeDim sDuplicate As ShapeDim sr_from_contour As ShapeRangeDim e As EffectSet sOriginal = ActiveShape'create the duplicate that will be the cut outlineSet sDuplicate = sOriginal.Duplicate'name itsDuplicate.Name = "Cut Outline"'set outline colorsDuplicate.Outline.Color.CMYKAssign 0, 100, 0, 0'set to have no fillsDuplicate.Fill.ApplyNoFill'from original shape, create contour effectSet e = sOriginal.CreateContour(, ConvertUnits(3, cdrMillimeter, ActiveDocument.Unit), , , , sOriginal.Fill.UniformColor.GetCopy)'separate contour group into a shaperangeSet sr_from_contour = e.Separate'name the contour shapesr_from_contour(1).Name = "Shape from Contour"'delete the original shapesOriginal.DeleteEnd Sub
If you copy and paste this, watch out for the forum software helpfully hyphenating a word when it breaks a line.
That is perfect, I appreciate this so much.
Not only has this solved my problem, but it has given me better insight to VBA syntax. I've made some very basic stuff - like a 90 degree rotation macro - and would love to do more. Seeing how the objects refer to one another helps a lot.
Thank you for your time with this.
You're welcome!
It was educational for me, as I have very little experience working with "effects" - e.g., Contour - using VBA.
It took me a while to figure this out - I've made minor modifications to the code by setting a ShapeRange and using the "For Each" function
It now processes multiple objects at once!
I might get the hang of this.
Cool!
Digging in even a modest amount on the VBA can really deliver "a lot for a little" in terms of speeding up some workflows.
That's especially true if you are writing the code for your own use, with full knowledge of where/how you want to use it, the nature of the content, etc.
hello!
great macro!
but what code did you use to make it process multiple objects?
Im not that good in codes, so i dont know what is For Each function?