AutoCaption.CaptionLabel property (Word)

Returns or sets the caption label ("Figure," "Table," or "Equation," for example) of the specified caption. Read/write Variant.

Syntax

expression. CaptionLabel

expression A variable that represents an 'AutoCaption' object.

Remarks

This property can be set to a string or a WdCaptionLabelID constant.

Example

This example displays the name ("Microsoft Excel Worksheet," for example) and caption label ("Figure," for example) for each item that has a caption added automatically when inserted.

Dim acLoop As AutoCaption 
 
For Each acLoop In AutoCaptions 
 If acLoop.AutoInsert = True Then MsgBox acLoop.Name _ 
 & vbCr & "Label = " & acLoop.CaptionLabel.Name 
Next acLoop

This example sets the caption label for Word tables to "Table" and then inserts a new table immediately after the selection.

With AutoCaptions("Microsoft Word Table") 
 .AutoInsert = True 
 .CaptionLabel = wdCaptionTable 
End With 
Selection.Collapse Direction:=wdCollapseEnd 
ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:=2, _ 
 NumColumns:=3

See also

AutoCaption 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.