Bookmark.InsertCaption Method (2007 System)

Inserts a caption immediately preceding or following the Bookmark control.

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v9.0 (in Microsoft.Office.Tools.Word.v9.0.dll)

Syntax

'Declaration
Public Sub InsertCaption ( _
    ByRef Label As Object, _
    ByRef Title As Object, _
    ByRef TitleAutoText As Object, _
    ByRef Position As Object, _
    ByRef ExcludeLabel As Object _
)
'Usage
Dim instance As Bookmark 
Dim Label As Object 
Dim Title As Object 
Dim TitleAutoText As Object 
Dim Position As Object 
Dim ExcludeLabel As Object

instance.InsertCaption(Label, Title, TitleAutoText, _
    Position, ExcludeLabel)
public void InsertCaption(
    ref Object Label,
    ref Object Title,
    ref Object TitleAutoText,
    ref Object Position,
    ref Object ExcludeLabel
)
public:
void InsertCaption(
    Object^% Label, 
    Object^% Title, 
    Object^% TitleAutoText, 
    Object^% Position, 
    Object^% ExcludeLabel
)
public function InsertCaption(
    Label : Object, 
    Title : Object, 
    TitleAutoText : Object, 
    Position : Object, 
    ExcludeLabel : Object
)

Parameters

  • Title
    Type: System.Object%

    The text to be inserted immediately following the label in the caption (ignored if TitleAutoText is specified).

  • TitleAutoText
    Type: System.Object%

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

  • ExcludeLabel
    Type: System.Object%

    true to not include the text label, as defined in the Label parameter. false to include the specified label.

Remarks

Optional Parameters

For information on optional parameters, see The Variable missing and Optional Parameters in Office Solutions.

Examples

The following code example adds a Bookmark control with text to the document and then inserts a caption into the bookmark.

This example is for a document-level customization.

Private Sub BookmarkInsertCaption()
    Me.Paragraphs(1).Range.InsertParagraphBefore()
    Dim Bookmark1 As Microsoft.Office.Tools.Word.Bookmark = _
        Me.Controls.AddBookmark(Me.Paragraphs(1).Range, "Bookmark1")
    Bookmark1.Text = "First bookmark"

    Bookmark1.InsertCaption(Label:=Word.WdCaptionLabelID.wdCaptionFigure, _
        Position:=Word.WdCaptionPosition.wdCaptionPositionAbove, _
        ExcludeLabel:=False)

End Sub
private void BookmarkInsertCaption()
{
    this.Paragraphs[1].Range.InsertParagraphBefore();
    Microsoft.Office.Tools.Word.Bookmark bookmark1 =
        this.Controls.AddBookmark(this.Paragraphs[1].Range,
        "bookmark1");
    bookmark1.Text = "First bookmark";

    object Label = Word.WdCaptionLabelID.wdCaptionFigure;
    object Position = Word.WdCaptionPosition.wdCaptionPositionAbove;
    object ExcludeLabel = false;

    bookmark1.InsertCaption(ref Label, ref missing, ref missing,
        ref Position, ref ExcludeLabel);
}

.NET Framework Security

See Also

Reference

Bookmark Class

Bookmark Members

Microsoft.Office.Tools.Word Namespace