InsertCaption

Syntax

InsertCaption [.Label = text] [, .TitleAutoText = text] [, .Title = text] [, .Delete] [, .Position = number]

Remarks

Inserts a caption above or below a selected item. The arguments for the InsertCaption statement correspond to the options in the Caption dialog box (Insert menu).

Argument

Explanation

.Label

The caption label to insert. If the label has not yet been defined, an error occurs. Use InsertAddCaption to define new labels.

.TitleAutoText

The AutoText entry whose contents you want to insert after the label in the caption (overrides any text specified for .Title).

.Title

The text to insert after the label in the caption (ignored if .TitleAutoText is specified).

.Delete

Removes the specified Label from the label box. Built-in labels (such as "Figure") cannot be deleted; if .Label specifies a built-in label, an error occurs.

.Position

When an item is selected, specifies whether to insert the caption above or below the item:

0 (zero) Above Selected Item

1 Below Selected Item


Example

This example inserts a caption with the label "Figure" and the title ": WordArt Object" after each WordArt object in the active document. GetSelStartPos() returns the character position of the insertion point before and after the EditGoTo instruction. When the character positions are the same, indicating there are no more WordArt objects, the While¼Wend loop is exited.


StartOfDocument
cp1 = GetSelStartPos()
EditGoTo "o'MSWordArt.2'"
cp2 = GetSelStartPos()
While cp1 <> cp2
    CharRight 1, 1
    InsertCaption .Label = "Figure", \
            .Title = ": WordArt Object", .Position = 1
    cp1 = GetSelStartPos()
    EditGoTo "o'MSWordArt.2'"
    cp2 = GetSelStartPos()
Wend

See Also

InsertAddCaption, InsertAutoCaption, InsertCaptionNumbering