Scripts or VBA-code for CorelDraw

 

Directly from the spreadsheet to the final drawing: Scripts or VBA-code (Visual Basic for Applications) created in spreadsheets draw graphical entities automatically.

CorelDraw might be one of the ordinary desktop publishing programs. Yet, similar to CAD-programs, CorelDraw allows to create graphical elements from scripts or VBA-code. The scripts or VBA-codes are an ASCII-sequence of drawing commands. They are executed within an open CorelDraw-file. Instead of going the detour over a stereoplot program, the polar plots can be done directly in CorelDraw. The drawings are already in the final format and you are free to add labels, change colors and 'touch' your data.

 

Data set within CorelDraw7. Bedding poles (black circles), in-situ remanences (red rectangles) and tilt-corrected remanences (blue rectangles).

Script editor: Script for CorelDraw7 to draw bedding poles.

 

There are two ways: Either CorelScript language (versions 6-13) or VBA-code (versions 10-13). The codes are created in a spreadsheet program and copied directly to the script or VBA-editor. Download worksheets from below.

CorelScript language is recommendable for versions until 9. However, only CorelDraw7 has a full documentation of the script language. Make sure to install the scripting option. Scripts can be executed also in later versions, but above Corel 9, VBA is the better option. You can also run the Script Editor of version 7.0 which has the full documentation, and execute the scripts in higher versions of CorelDraw.

Scripts have the following form:

WITHOBJECT "CorelDraw.Automation.X"
.CreateEllipse -7066207 , -8562453 , -7062207 , -8558453 , 0 , 0 , 0
.CreateEllipse -2718207 , -7967957 , -2714207 , -7963957 , 0 , 0 , 0
.CreateEllipse 3728253 , -6816671 , 3732253 , -6812671 , 0 , 0 , 0
END WITHOJECT

X: CorelDraw Version number (7, 8, 9, ...)

CorelScript uses the center of the page as the origin (0,0). Units are tenths of a micron, independently from the scale you use in the Grid and Ruler setup. Empty lines or spaces do not affect execution. Execution is always performed in the first program instance of CorelDraw (open CorelDraw only once).

 

VBA-code is used in versions from 10 on.

It works in relative page coordinates. It is also created in spreadsheet programs and copied to the VBA-editor of CorelDraw. It is fast and precise.

There only seems to be a limitation with respect to the number of command lines (maximum about 750).

Make sure to remove the "Option Explicit" command in the uppermost line, otherwise it won't work.

 

 

Download the following files and spread-sheets:

Execute the CorelScripts in spheres.cdr, and the VBA-code in sphere_VBA.cdr. These files contain the unit circle in orthographic and equal-area projection.

for CorelScript

corelscripts.zip:

Excel sheets to create scripts for remanences, bedding poles, remanence small circles, small circle intersections, and tilt axes.

 

for VBA

corelVBA.zip

Excel sheets to create VBA-code for remanences, bedding poles, remanence small circles, small circle intersections, and tilt axes.

 

Script editor with reference

Can be run for all versions