Bookmark.Previous(Object, Object) Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
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
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.