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
 
Variable Pictures

There are several modes of inserting variable graphics.

1. Each image is the same size and so the position of other components on the page are not effected.
A common example are photo ID cards such as drivers licenses.
Preparation of the images can require either manual or automated cropping of images. See PhotoPaint.

2. Images on the page can have differing dimension so other elements on the page must automatically position themselves around the variable image.
This is not that common with variable documents but for newspapers and magazines where a portrait photo is substituted for a landscape photo the text must still wrap around the photo.

Usually there is text that accompanies the photos.
Something to consider is how to marry each photo with the appropriate text.
A text file and its photo could have the same file names.
Alternatively their file names could be stored in a text file, Excel file or database.

Another method is to have a drop box.
When a photo & text file are placed in the drop box (folder) CorelDraw automatically could use the photo & text and then move them to another folder.


To import a picture into CorelDraw you can use the following in your code, replace the location with your location & file name.

    Dim shPIC As Shape

    'There appears to be suitable default settings for CreateStructImportOptions
    ' so that you do not have to enter settings for CreateStructImportOptions
    'Import(FileName As String, [Filter As cdrFilter = cdrAutoSense], [Options As StructImportOptions])

    ActiveLayer.Import "C:\User\User\Documents\Graphics\123.jpg"
    Or
    'ActiveLayer.Import "C:\User\User\Documents\Graphics\123.jpg", cdrAutoSense

    'Specifically for jpg files.
    'ActiveLayer.Import "C:\User\User\Documents\Graphics\123.jpg", cdrJPEG

    'For cpt files.
    'ActiveLayer.Import "C:\User\User\Documents\Graphics\123.cpt", cdrCPT

    'Import does not provide a means of refering to the graphic imported but it is the active shape.
    Set shPIC = ActiveShape

    'Now that the photo is known as shPIC this is where you can move, resize etc the photo.
    shPIC.Move 2, 0

    'This next line removes shPIC from memory and so saves memory.
    Set shPIC = Nothing


I must admit that I have not used this enough to determine if cdrAutoSense works in all instance.
You may need to first determine the photo type and then use the appropriate Import filter.
This would mean either using various If Statements or better still a Select Case.





This section is in the process of development.