Coreldraw Macros
1. Active Document & Selection
Dim doc As Document Set doc = ActiveDocument
Dim s As Shape For Each s In ActiveSelection.Shapes s.Fill.UniformColor.RGBAssign 255, 0, 0 'Turns selection red Next s
2. Loop Through All Shapes on a Page
Dim sh As Shape
For Each sh In ActivePage.Shapes
sh.Outline.SetProperties 0.5, OutlineStyles(1) 'Sets 0.5pt outline
Next sh
3. Create a New Rectangle
Dim rect As Shape
Set rect = ActiveLayer.CreateRectangle(1, 1, 2, 2) 'x1,y1,x2,y2
rect.Fill.ApplyFountainFill , , , , , , "Black", "White"
4. Message Box (User Notification)
MsgBox "Your macro finished successfully! Total shapes: " & ActivePage.Shapes.Count
The Problem: CorelDRAW’s native export requires you to export pages one by one or use a rigid naming convention. Users often need to export every page of a document as a JPG/PDF with a specific prefix (e.g., ProjectName_Page01.jpg) without clicking through dialogs repeatedly. coreldraw macros
The Solution: A VBA macro that iterates through every page, defines a bounding box, and exports the file automatically with a standardized name.
CorelDRAW uses VBA, the same language used in Microsoft Excel and Word. This is crucial because it means millions of developers already understand the syntax. If you know how to write an Excel macro, you already understand 80% of CorelDRAW macro writing. CorelDRAW uses VBA
Macros in CorelDRAW are stored in Project files with the extension .gms.