Bookmark.Relocate Method (2007 System)
In outline view, moves the paragraphs within the Bookmark control after the next visible paragraph or before the previous visible paragraph.
Namespace: Microsoft.Office.Tools.Word
Assembly: Microsoft.Office.Tools.Word.v9.0 (in Microsoft.Office.Tools.Word.v9.0.dll)
Syntax
'Declaration
Public Sub Relocate ( _
Direction As Integer _
)
'Usage
Dim instance As Bookmark
Dim Direction As Integer
instance.Relocate(Direction)
public void Relocate(
int Direction
)
public:
void Relocate(
int Direction
)
public function Relocate(
Direction : int
)
Parameters
Direction
Type: System.Int32WdRelocate. The direction of the move.
Remarks
Body text moves with a heading only if the body text is collapsed in outline view or if it is part of the Bookmark control.
Examples
The following code example adds text to the first paragraph and then a Bookmark control with text to the second paragraph. The code then relocates the second bookmark to the first paragraph.
This example is for a document-level customization.
Private Sub BookmarkRelocate()
Me.Paragraphs(1).Range.InsertParagraphBefore()
Me.Paragraphs(1).Range.InsertParagraphBefore()
Me.Paragraphs(1).Range.Text = "This is sample text. "
Dim Bookmark1 As Microsoft.Office.Tools.Word.Bookmark = _
Me.Controls.AddBookmark(Me.Paragraphs(2).Range, "Bookmark1")
Bookmark1.Text = "This is the text of the bookmark."
Me.ActiveWindow.View.Type = Word.WdViewType.wdOutlineView
Bookmark1.Relocate(Word.WdRelocate.wdRelocateUp)
End Sub
private void BookmarkRelocate()
{
this.Paragraphs[1].Range.InsertParagraphBefore();
this.Paragraphs[1].Range.InsertParagraphBefore();
this.Paragraphs[1].Range.Text = "This is sample text. ";
Microsoft.Office.Tools.Word.Bookmark bookmark1 =
this.Controls.AddBookmark(this.Paragraphs[2].Range,
"bookmark1");
bookmark1.Text = "This is the text of the bookmark.";
this.ActiveWindow.View.Type = Word.WdViewType.wdOutlineView;
bookmark1.Relocate((int)Word.WdRelocate.wdRelocateUp);
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.