Bookmark.Previous(Object, Object) Méthode

Définition

Obtient un objet Range relatif au contrôle Bookmark.

public Microsoft.Office.Interop.Word.Range Previous (ref object Unit, ref object Count);

Paramètres

Count
Object

Nombre d'unités du déplacement vers l'arrière à effectuer. La valeur par défaut est 1.

Retours

Range

Objet Range relatif au contrôle Bookmark.

Exemples

L’exemple de code suivant ajoute du texte au premier paragraphe, puis ajoute un Bookmark contrôle au deuxième mot. Le code sélectionne ensuite le mot qui précède le signet.

Cet exemple est destiné à une personnalisation au niveau du document.

private void BookmarkPrevious()
{
    this.Paragraphs[1].Range.InsertParagraphBefore();
    this.Paragraphs[1].Range.Text = "Text before the bookmark.";
    Microsoft.Office.Tools.Word.Bookmark bookmark1 =
        this.Controls.AddBookmark(this.Paragraphs[1].Range.Words[2],
        "bookmark1");
    
    object Unit = Word.WdUnits.wdWord;
    object Count = 1;

    bookmark1.Previous(ref Unit, ref Count).Select();
}
Private Sub BookmarkPrevious()

    Me.Paragraphs(1).Range.InsertParagraphBefore()
    Me.Paragraphs(1).Range.Text = "Text before the bookmark."

    Dim Bookmark1 As Microsoft.Office.Tools.Word.Bookmark = _
        Me.Controls.AddBookmark(Me.Paragraphs(1).Range.Words(2), _
        "Bookmark1")
    
    Bookmark1.Previous(Word.WdUnits.wdWord, 1).Select()

End Sub

Remarques

Paramètres facultatifs

Pour plus d’informations sur les paramètres facultatifs, consultez paramètres facultatifs dans les solutions Office.

S’applique à