I'm fairly new to using macros with this program. I have programming experience but fairly new to VBA syntax so I've tried sticking to just straightforward recording as far as I can. Basically what I'm trying to do is take some objects that I've copied and pasted to the file, then move them into some pre-made templates and use intersect to basically punch out a design.
I've found that I can easily automate most steps like resizing, rotating etc just by simply recording it. However I'd like to be able to select a specific object rather than just "Active Layer Shape 1" which I've found can change depending on the order they are created. Then I'd like to move them to a specific location rather than it depending on the starting location of the object, as they will need to be slotted into my template.
I hope that makes sense, any help would be appreciated!
Cm1602 said: However I'd like to be able to select a specific object rather than just "Active Layer Shape 1" which I've found can change depending on the order they are created. Then I'd like to move them to a specific location rather than it depending on the starting location of the object, as they will need to be slotted into my template.
It's easy enough to tell a macro to go to work on the currently selected object(s).
What sort of alignment do you have in mind in order to position the content in your template? As in, do you want the object centered in X and Y on a particular point, or with it's upper LH corner aligned to a specific point, or...?
Cm1602 said:I think centred on an x and y is closest to what I'm looking for as far as moving the objects is concerned. For selecting objects I think I know how to work on the currently selected object, however when working with multiple objects is it possible to specify which objects I want a certain line of code to work on? For simplicity's sake lets say I have a square and a circle. Is there a way to write a single macro that does different things to the square than it does to the circle without selecting them in a specific order?
I think that will depend on the nature of the objects that you are working with - whether they will consistently have some characteristic(s) that you can use to identify them in the code to decide what to do with them.
If the shapes can't be automagically sorted out in the code, then a compromise might be a macro that takes the form of a VBA form with buttons so that you could visually identify and then select certain object(s), then press a button on the form to carry out a specific operation on the selected object(s).
I have wrote a macro for doing this many years ago. That feature is free. You can do even more and transfer desired properties & effects for selected or named objects in all pages at once.
Copy / paste position, size, effects, fill or outline properties between selected CorelDRAW objects or automatically for all instances of given name