Muokkaa

Jaa


Selection.InsertCaption method (Word)

Inserts a caption immediately preceding or following the specified selection.

Syntax

expression. InsertCaption( _Label_ , _Title_ , _TitleAutoText_ , _Position_ , _ExcludeLabel_ )

expression Required. A variable that represents a Selection object.

Parameters

Name Required/Optional Data type Description
Label Required Variant The caption label to be inserted. Can be a String or one of the WdCaptionLabelID constants. If the label has not yet been defined, an error occurs. Use the Add method with the CaptionLabels object to define new caption labels.
Title Optional Variant The string to be inserted immediately following the label in the caption (ignored if TitleAutoText is specified).
TitleAutoText Optional Variant The AutoText entry whose contents you want to insert immediately following the label in the caption (overrides any text specified by Title).
Position Optional Variant Specifies whether the caption will be inserted above or below the selection. Can be one of the WdCaptionPosition constants.
ExcludeLabel Optional Variant True does not include the text label, as defined in the Label parameter. False includes the specified label.

Example

This example inserts a Figure caption at the insertion point.

Selection.Collapse Direction:=wdCollapseStart 
Selection.InsertCaption Label:="Figure", _ 
 Title:=": Sales Results", Position:=wdCaptionPositionBelow

See also

Selection Object

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.