WordCreateLabels (not supported in Axiell Collections)

syntax

result = WordCreateLabels (labels_template, document, option, occurrence)

Arguments

labels_template, document: text

option, occurrence: numeric

result: integer (error code)

Meaning

Not supported in Axiell Collections and RunAdapl.

With Microsoft Word (version 97 or higher), you can use ADAPL to place data from Adlib into a Word labels template to automatically make a labels document.

WordCreateLabels allows you the freedom to use MS Word to change the format and layout of your data. For example, you may want to produce address labels using Adlib data.

Use the arguments as follows:

labels_template is a text variable or constant with the name of the (custom) Word labels template that you want to use.
document is a text variable or constant that includes the file name in which the resulting document is to be stored (a Word document).
option is a numerical variable or constant that determines a few settings (see table below).
occurrence is a numerical value or constant, which has to be zero if you want to print all occurrences of the current record, or the number of a specific occurrence if you only want to print that occurrence.
result is 0 when the operation was succesful, otherwise an error code results.

 

Option

Meaning

1

MS Word will be visible and appears in a separate window on top of your Adlib application.

2

Start making a document and use the current record.

4

Use the current record and finish the document.

8

Print all occurrences of the current record in one label. This may be handy to print data of all copies of a book on one label, for example.

 

Note that you can add these options if desired, to obtain their combined functionality.

If you enter 6 (2 + 4), you start a document, print the current record, and end making the document. MS Word won't be visible during printing, and for each occurrence of the current record a label will be printed in the current document. If you use option 6 for all records, then for each record in the selection a new document will be created.

If you'd like all records in the selection to be printed together in one document, you will have to use option 2 (or 3) for the first record in the selection only, option 1 (or 0) for all the following records, and 4 (or 5) for the last. (You can also add 8 to these values if necessary.)

Note that you always have to start and close a document being made explicitly! (The document will only be created after it has been built up in memory and has been finished explicitly.)

 

Example 1 (for Adlib Library)

WordCreateLabels (‘c:\bibl\wincat\mytemplate.dot’, ‘c:\test.doc’, 6, 0)

Example 2 (for Adlib Museum Standard)

WordCreateLabels (‘c:\adlib\standard\mytemplate.dot’, ‘c:\test.doc’, MyOption, 1)

Here, MyOption is a custom variable that may hold different values dependent on program flow that checks whether the current record is the first in the selection, one in the middle or the last.

See also

Accessing data for a Word template from an adapl