Never use recorded code as your final macro. Instead, use the recorder to learn the object model (e.g., ActiveDocument.ReferencePoint = cdrCenter ), then immediately delete the Move and Zoom commands. Rewrite the logic using relative references instead of absolute selections.

Next, she added a function to scan for the company logo by name, check its bounding box, and scale it proportionally to fit a target frame while keeping the alignment centered. She tested on a sample file and watched the logo snap perfectly into place. She grinned.

Dim sr As ShapeRange Set sr = ActivePage.Shapes.All

Do you have a favorite CorelDRAW macro that you've written? Share it with us in the comments below! We'd love to hear about your experiences with macros and learn from your expertise.

You don’t need to be a programmer to benefit from CorelDRAW macros. Begin by recording simple actions, then open the VBA editor to see the generated code. Tweak one line at a time. Soon, you’ll be automating tasks that save hours every week.

| Problem with basic macros | Better macro solution | |---------------------------|------------------------| | Hard-coded selections | Works on any active selection | | No error handling | Gracefully skips incompatible objects | | Slow on large files | Uses Application.Optimization = True | | One-time use | Modular, reusable functions |

Suggested next step: pick one repetitive task you do in CorelDRAW and I’ll provide a tailored macro scaffold for it.

ActiveDocument.CustomProperties.Add "UserSetting", "1200"

Newsletter
Wertvolle Tipps und Hinweise
für Ihre Abrechnung
Jetzt anmelden
schließen