CorelDraw & VBA
Summary & Introduction
Guide to CorelDraw VBA
Creating Variable Data
Variable Data From Access
Variable Data From Excel
Variable Data Without a Data File
CorelDraw BarCode Wizard
EAN13 BarCodes Without The Wizard
Code 39 BarCodes Without The Wizard
ITF-14 BarCodes Without The Wizard
Code 128 BarCodes Without The Wizard
QR BarCodes
Variable Pictures
Sorting for Guillotining
Repositioning Data
Pantone Colors
Saving VBA Code to a Previous Version of CorelDraw
PhotoPaint
Miscellaneous VBA
Help
 
Help

This section is to provide help, show tips & sample code.

I use an Excel WorkBook to hold sample code that I think I may use. I use many WorkSheets.
Each WorkSheet's name identifies the specific program that uniquely uses the VBA code.
e.g. CorelDraw, CorelDraw 12, Access, Outlook, Word, API, VBE etc and VBA for all common VBA Code.
Excel enables me to search individual worksheets or the whole workbook to find the code I want.


Help Files

Corel 11 does not have any pdf help files.
It only has Draw11VBA.hlp and PP11VBA.hlp
These are located at C:\Program Files\Corel\Corel Graphics 11\Programs\.
These help files are those normally accessed from the VBA Editor.



Corel 12 has five help files.
These are in the folder C:\Program Files\Corel\Corel Graphics 12\Programs\.
They are;
dvba_pg.pdf - A Programming Guide to VBA in Corel.
VBA Object Model.pdf - CorelDraw object model
PP VBA Object Model.pdf           - PhotoPaint object model
draw12vba.chm - CorelDraw help file used by the CorelDraw application.
pp12vba.chm - PhotoPaint help file used by the PhotoPaint application.


Corel X3 and X4 each have five help files.
These are in the folders
C:\Program Files\Corel\CorelDRAW Graphics Suite X3\Programs\ and.
C:\Program Files\Corel\CorelDRAW Graphics Suite X4\Programs\ respectively.
They are;
dvba_pg.pdf - A Programming Guide to VBA in Corel.
CorelDRAW VBA Object Model.pdf   - CorelDraw object model.
PP VBA Object Model.pdf - PhotoPaint object model.
draw_vba.chm - CorelDraw help file used by the CorelDraw application.
pp_vba.chm - PhotoPaint help file used by the PhotoPaint application.


Corel X5 has five help files.
These are in the folders
C:\Program Files\Corel\CorelDRAW Graphics Suite X5\Data\
They are;
Macro Programming Guide.pdf   - Corelprogramming guide.
CorelDRAW Object Model Diagram.pdf   - CorelDraw object model.
Corel PHOTO-PAINT Object Model Diagram.pdf - PhotoPaint object model.
draw_om.chm - CorelDraw help file used by the CorelDraw application.
pp_om.chm - PhotoPaint help file used by the PhotoPaint application.


Corel X6 has a number of help files.
File Name Description Location
Macro Programming Guide.pdf   - Corelprogramming guide. C:\Program Files\Corel\CorelDRAW Graphics Suite X6\Data\
CorelDRAW Object Model Diagram.pdf   - CorelDraw object model. C:\Program Files\Corel\CorelDRAW Graphics Suite X6\Data\
Corel PHOTO-PAINT Object Model Diagram.pdf - PhotoPaint object model. C:\Program Files\Corel\CorelDRAW Graphics Suite X6\Data\
draw_om.chm - CorelDraw help file used by the CorelDraw application.C:\Program Files\Corel\CorelDRAW Graphics Suite X6\Data\
DrwHints.chm - CorelDraw Hints C:\Program Files\Corel\CorelDRAW Graphics Suite X6\Languages\EN\Help\Draw\
PPHints.chm - PhotoPaintHints C:\Program Files\Corel\CorelDRAW Graphics Suite X6\Languages\EN\Help\PHOTO-PAINT\
GB.pdf - CorelDraw Guide Book C:\Program Files\Corel\CorelDRAW Graphics Suite X6\Languages\EN\Help\
IFE_1.pdf - PhotoPaint Design Tutorial C:\Program Files\Corel\CorelDRAW Graphics Suite X6\Languages\EN\Tutorials\
IFE_4.pdf - CorelDraw Design Tutorial C:\Program Files\Corel\CorelDRAW Graphics Suite X6\Languages\EN\Tutorials\
IFE_6.pdf - CorelDraw Design Tutorial C:\Program Files\Corel\CorelDRAW Graphics Suite X6\Languages\EN\Tutorials\
WTEN.chm - CorelDraw Writing Tools Help C:\Program Files\Corel\CorelDRAW Graphics Suite X6\WritingTools\
WTGEUK.chm - CorelDraw UK Grammatik Help C:\Program Files\Corel\CorelDRAW Graphics Suite X6\WritingTools\
WTGEUS.chm - CorelDraw US Grammatik Help C:\Program Files\Corel\CorelDRAW Graphics Suite X6\WritingTools\
WTSPUT.chm - CorelDraw Spell Utility Help C:\Program Files\Corel\CorelDRAW Graphics Suite X6\WritingTools\


Corel X7 has a number of help files.
File Name Description Location
Macro Programming Guide.pdf   - Corelprogramming guide. C:\Program Files\Corel\CorelDRAW Graphics Suite X7\Data\
CorelDRAW Object Model Diagram.pdf   - CorelDraw object model. C:\Program Files\Corel\CorelDRAW Graphics Suite X7\Data\
Corel PHOTO-PAINT Object Model Diagram.pdf - PhotoPaint object model. C:\Program Files\Corel\CorelDRAW Graphics Suite X7\Data\
draw_om.chm - CorelDraw help file used by the CorelDraw application. C:\Program Files\Corel\CorelDRAW Graphics Suite X7\Data\
pp_om.chm - CorelPHOTOPAINT Macros help file. C:\Program Files\Corel\CorelDRAW Graphics Suite X7\Data\
FontNav.chm - Font Navigator help file. C:\Program Files\Corel\CorelDRAW Graphics Suite X7\FontNav\
DrwHints.chm - CorelDraw Hints C:\Program Files\Corel\CorelDRAW Graphics Suite X7\Languages\EN\Help\Draw\
PPHints.chm - PhotoPaintHints C:\Program Files\Corel\CorelDRAW Graphics Suite X7\Languages\EN\Help\PHOTO-PAINT\
IFE_1.pdf - PhotoPaint Design Tutorial C:\Program Files\Corel\CorelDRAW Graphics Suite X7\Languages\EN\Tutorials\
IFE_2.pdf - PhotoPaint Design Tutorial C:\Program Files\Corel\CorelDRAW Graphics Suite X7\Languages\EN\Tutorials\
IFE_4.pdf - CorelDraw Design Tutorial C:\Program Files\Corel\CorelDRAW Graphics Suite X7\Languages\EN\Tutorials\
IFE_6.pdf - CorelDraw Design Tutorial C:\Program Files\Corel\CorelDRAW Graphics Suite X7\Languages\EN\Tutorials\
IFE_Cookbook.pdf - CorelDraw Design Tutorial C:\Program Files\Corel\CorelDRAW Graphics Suite X7\Languages\EN\Tutorials\
IFE_font.pdf - CorelDraw Font Design Tutorial C:\Program Files\Corel\CorelDRAW Graphics Suite X7\Languages\EN\Tutorials\
WTEN.chm - CorelDraw Writing Tools Help C:\Program Files\Corel\CorelDRAW Graphics Suite X7\WritingTools\
WTGEUK.chm - CorelDraw UK Grammatik Help C:\Program Files\Corel\CorelDRAW Graphics Suite X7\WritingTools\
WTGEUS.chm - CorelDraw US Grammatik Help C:\Program Files\Corel\CorelDRAW Graphics Suite X7\WritingTools\
WTSPUT.chm - CorelDraw Spell Utility Help C:\Program Files\Corel\CorelDRAW Graphics Suite X7\WritingTools\



CorelDraw Objects and Properties
If you do not know what objects or properties are available then you can use Watch Window.

Reference an object using Set YOUR_VARIABLE_NAME = AN_OBJECT

Create a simple procedure as shown in the picture below, Sub TEST().

Select the variable you are interested in and right button it. Select Add Watch. Create a toggle break after your variable takes on its values.
See the brown dot to the left of the command line in the picture below. Run the procedure.
The procedure will run & stop at the brown dot & your variable will appear in the Watch window with a plus sign at its left.
Expand the plus sign & examine it its sub-objects & properties.
The watch window will list nearly all the objects properties related to this variable.
It is an invaluable aid to find objects & properties of those objects.
It unfortunately does not list methods to alter the object or properties, but it is my first start.
I rarely use the Immediate Window! I watch multiple variables in the Watches Window and step through the procedure using F8.
The value of each variable is displayed simultaneously at each stage of the program.

Watches Window.jpg



CorelDraw VBA has several problems.

  1. There is no direct access to the BarCode Wizard.
  2. Pantone Colors cannot be used directly unless you know the color number in VBA.
  3. CorelDraw X4 has a problem with its Pantone Color numbers. See the macro in the topic "Pantone Colors" where a correction to the color numbers is required.
  4. ActiveDocument.Pages(1).Color.CMYKAssign 50, 0, 100, 0 colors the background of the Master Page.
    I know it is not possible to color the background of individual pages but this code should not be allowed unless you can individually color each page.
    Why is it that the background color of the Master Page does not appear in "Object Manager" but must be altered in "Tools", "Options", "Document", "Page", "Background"?
  5. Save VBA files into older versions even if they are not fully compatible with the old version.
  6. Change the CorelDraw file extension from cdr to cx5, cx6 etc for each new CorelDraw version so you know which version created the file.
  7. You cannot refer to a font by its name in CorelDRAW.FontList("Arial") but instead must the font item number such as CorelDRAW.FontList(84) or what ever number Arial is on your machine.
  8. VBA support and help for Photo-Paint is worse then pathetic. Changes have been made to CorelDraw VBA over the years but nothing to Photo-Paint.
    You still have to use script in many cases. There is no help for script!
2021_02_14