Quick links to procedures on this page:

Working with macros

You can save time by using a macro to automate a series of repetitive tasks. A macro lets you specify a sequence of actions so that you can quickly repeat those actions later.

You don’t need any programming experience to use macros — in fact, the basic tools for working with macros are available within the main application window. However, if you want to have more control over your macros, you can use the following built-in programming environments:

*

For detailed information on the differences between VBA and VSTA, please see the programming guide on the Developer area on the CorelDRAW community website.

Getting started with macros

The macro features for VBA and VSTA are installed with the software by default, but you can manually install these features if necessary. You can specify options for the VBA feature.

*

To use VSTA macro features with CorelDRAW, you must have Microsoft Visual Studio 2017 installed. To use the VSTA Editor, you must first install Microsoft Visual Studio 2017, Community, Professional, Premium, Ultimate or Enterprise Edition; and then reinstall Microsoft Visual Studio Tools for Applications 2017 from microsoft.com.

If you install Microsoft Visual Studio after installing CorelDRAW Graphics Suite, you must re-install the VSTA macro features by modifying your CorelDRAW Graphics Suite installation. For more information, see To manually install the macro features.

The macro features provide several tools for working with macros in the main application window:

Corel macros

The macros provided with the application are listed and described in the following table.

 

Creating macros

Macros are stored in modules (also called "code modules"), which are stored in macro projects. The Macro Manager docker lets you view and manage all of the macro projects, modules, and macros that are available to you.

You can use the Macro Manager docker to create macro projects in the form of Global Macro Storage (GMS) files or Corel VSTA Projects (CGSaddon). Using such files is an excellent way to bundle the components of your macro project for sharing with others. You can use the Macro Manager docker to open (or "load") the macro projects that you create, as well as the macro projects that install with the software or that are otherwise made available to you. You can also use the Macro Manager docker to rename macro projects, as well as to copy and close (or "unload") GMS-based and VSTA macro projects.

*

Some macro projects are locked and cannot be modified.

*

When you create a document, a macro project for that document is automatically added to the Macro Manager docker. Although you can store macros within the macro project for a document — for example, to create an all-in-one template — it is recommended that you instead use GMS files to store your macro projects.

Each macro project contains at least one module. You can use the Macro Manager docker to add a module to a VBA-based macro project, or to open existing modules for editing. You can also use the Macro Manager docker to rename or delete VBA modules.

*

The editing feature is disabled for some modules.

Finally, you can use the Macro Manager docker to create macros within the available modules. You don’t need any programming experience to create macros; however, if you have programming experience and want to edit VBA macros, you can do so by using the Macro Editor. You can also use the Macro Manager docker to rename and delete VBA macros.

Recording macros

You can record macros and save them for later use.

You can also record temporary macros for actions that you need to repeat only a few times. A temporary macro is accessible until a new temporary macro is recorded.

*

The recording feature is disabled for some macro projects.

*

Before recording a macro, make sure that you know exactly which actions you want to record and the order in which you want to record them. When you start recording, the macro recorder captures every change that you make in a drawing. For example, if you create a shape, resize the shape, and then change its color, the macro records all the changes. When you are done making the changes, you must stop recording the macro.

Playing macros

You can perform the actions that are associated with a macro by playing that macro.

You can also play a temporary macro.

Learning more about macros

The Developer area on the CorelDRAW community website can help you with its wealth of useful resources: a programming guide, detailed Object Model reference documentation with code samples, object model diagrams, and in-depth programming articles and tutorials.

The Object Model reference documentation, also referred to as API documentation, includes help on every feature and function that can be automated in the applications. (Collectively, these features and functions are called an "object model.") You can easily access relevant documentation from within the Macro Editor.

The Object Model diagrams provide a hierarchical representation of the features and functions that can be automated in CorelDRAW, Corel PHOTO-PAINT, and Corel DESIGNER.

*

For more detailed information about VBA and its programming environment, please consult the Microsoft Visual Basic Help from the Help menu in the Macro Editor.

For more detailed information about VSTA and its programming environment, please consult the Help menu in the VSTA Editor.

To manually install the macro features Back to Top

*

The macro features for VBA and VSTA are installed with the software by default.

To specify VBA options Back to Top
To access the macro tools Back to Top

 

Display the Macros toolbar
Click Window Toolbars Macros.
Display the Macro Manager docker
Click Tools Macros VSTA Editor. (VSTA must be installed on your computer.)
To create a macro project Back to Top

 

Right-click the project in the list, click Copy to, and then choose the target location for the copied project.
NOTE: You cannot copy a document-based macro project. Such projects are stored within a document and cannot be managed separately from that document.
Click the Simple mode button .
NOTE: You can close a document-based macro project only by closing the document in which it is stored.

*

Some macro projects are locked and cannot be modified.

To create a macro Back to Top

 

*

Some macro projects are locked and cannot be modified.

To record a macro Back to Top

*

You cannot record a macro if all available macro projects are locked.

Not all actions can be recorded — some because of their complexity (although many such actions can be manually coded in the Macro Editor). When an action cannot be recorded, a comment is placed in the macro code ("The recording of this command is not supported."), but the recording process continues until you stop it. You can view any comments in the code by opening the macro in the Macro Editor.

*

By default, macros are recorded in the GlobalMacros project so that they can be accessed from other documents. However, you can change the default macro project for recordings by right-clicking another project in the Macro Manager docker, and then clicking Set as recording project. You cannot specify a locked macro project.

You can cancel recording a macro, and discard any commands recorded thus far, by clicking Tools Macros Cancel recording.

You can also record, pause, and stop recording a macro by using the Macros toolbar or the Macro Manager docker (Tools Macros Macro Manager).

 

Save the actions in the Undo list as a VBA macro
Click Edit Undo manager, perform the actions that you want to record, and then click the Save list to a VBA macro button in the Undo manager docker.
To record a temporary macro Back to Top

*

You cannot record a temporary macro if all available macro projects are locked.

Not all actions can be recorded.

*

By default, macros are recorded in the GlobalMacros project so that they can be accessed from other documents. However, you can change the default recording project by right-clicking another project in the Macro Manager docker, and then clicking Set as recording project. (You cannot specify a locked macro project.) If you want, you can create multiple temporary recordings by assigning each one to its own macro project.

You can cancel recording a macro, and discard any commands recorded thus far, by clicking Tools Macros Cancel recording.

You can also pause and stop recording a temporary macro by using the Macros toolbar or the Macro Manager docker (Tools Macros Macro Manager).

To play a macro Back to Top
To play a temporary macro Back to Top

*

This option is enabled only after you record a temporary macro.

*

If you have created multiple temporary macros, you must specify which macro project contains the one that you want to run. Right-click the project in the Macro Manager docker, and then click Set as recording project.

To access Object Model reference documentation from within the Macro Editor Back to Top

*

You can also display information for any item in the Code window of the Macro Editor by clicking that item and pressing F1.

Not all suite components documented in this Help are available in our Trial, Academic, and OEM versions. Unavailable components may include Corel applications, product features, third-party utilities, and extra content files.


Feedback
Was this page helpful? Send feedback. (Internet connection required.)

Copyright 2018 Corel Corporation. All rights reserved.