Quick links to procedures on this page:
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 Corel PHOTO-PAINT Macros Help file (pp_om.chm, which is located in the Data folder for the installed software).
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 Corel PHOTO-PAINT, you must have Microsoft Visual Studio 2012 or later installed.
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:
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.
Corel PHOTO-PAINT includes sample macros, which supply additional functionality, demonstrate automation in the software, and provide sample code. For information on these sample macros, please see the Corel PHOTO-PAINT Macros Help file (pp_om.chm, which is located in the Data folder for the installed software).
Playing macros
You can perform the actions that are associated with a macro by playing that macro.
Learning more about macros
Corel PHOTO-PAINT provides additional resources that contain helpful information about macros. These additional resources, which are located in the Data folder for the installed software, are described in the following table.
The Macros Help file includes documentation on every feature and function that can be automated in the application. (Collectively, these features and functions are called an "object model.") You can easily access the Macros Help file from within the Macro Editor.
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.
2 . |
Double-click CorelDRAW Graphics Suite on the Uninstall or change a program page. |
3 . |
Enable the Modify option in the wizard that appears, and follow the instructions. |
4 . |
On the Features page of the installation wizard, enable the following check boxes in the Utilities list box: |
The macro features for VBA and VSTA are installed with the software by default.
2 . |
In the Workspace list of categories, click VBA. |
3 . |
In the Security area, specify how to control the risk of running malicious macros by clicking Security options. |
4 . |
On the Security level page of the Security dialog box, enable one of the following options: |
|
• |
Very high — allows only macros installed in trusted locations to run. All other signed and unsigned macros are disabled. |
|
• |
High — allows only signed macros from trusted sources to run. Unsigned macros are automatically disabled. |
|
• |
Medium — lets you choose which macros run, even if they are potentially harmful |
|
• |
Low (not recommended) — allows all potentially unsafe macros to run. Enable this setting if you have virus-scanning software installed, or if you check the safety of all documents that you open. |
5 . |
On the Trusted publishers page of the Security dialog box, review which macro publishers are trusted. Click View to display details on the selected macro publisher, or click Remove to delete the selected macro publisher from the list. |
6 . |
Disable the Delay load VBA check box if you want to load the VBA feature at start-up. |
• |
In the Macro Manager docker, do one of the following: |
|
• |
Click Visual Studio Tools for Applications in the list, click New, and then click New macro project. |
|
• |
Click Visual Basic for Applications in the list, click New, and then click New macro project. |
|
|
|
|
Click Visual Studio Tools for Applications in the list, click Load, and then choose the project. |
|
Click Visual Basic for Applications in the list, click Load, and then choose the project. |
|
|
|
|
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.
• |
In the Macro Manager docker, do one of the following: |
Some macro projects are locked and cannot be modified.
|
• |
Click Tools Macros Run macro, or click the Run macro button on the Macros toolbar. From the Macros in list box, choose the project in which the macro is stored. From the Macro name list, choose the macro. Click Run. |
|
• |
In the Macro Manager docker, double-click the macro in the list. |
|
• |
In the Macro Manager docker, click the macro in the list, and then click the Run button . |
|
• |
In the Macro Manager docker, right-click the macro in the list, and then click Run. |
2 . |
Choose PHOTOPAINT from the Library list box. |
You can also display a Help topic for any item in the Code window of the Macro Editor by clicking that item and pressing F1.
Copyright 2015 Corel Corporation. All rights reserved.