Skip to content

Latest commit

 

History

History
55 lines (34 loc) · 1.88 KB

Word.Range.InsertCaption.md

File metadata and controls

55 lines (34 loc) · 1.88 KB
title keywords f1_keywords api_name ms.assetid ms.date ms.localizationpriority
Range.InsertCaption method (Word)
vbawd10.chm157155745
vbawd10.chm157155745
Word.Range.InsertCaption
fee41e81-1a78-2886-9693-dcf90da7c1bc
06/08/2017
medium

Range.InsertCaption method (Word)

Inserts a caption immediately preceding or following the specified range.

Syntax

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

expression Required. A variable that represents a Range 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 range. Can be either 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 caption below the first table in the active document.

ActiveDocument.Tables(1).Range.InsertCaption _ 
 Label:=wdCaptionTable, _ 
 Position:=wdCaptionPositionBelow

See also

Range Object

[!includeSupport and feedback]