Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Moves the start position of the Bookmark control.
Namespace: Microsoft.Office.Tools.Word
Assembly: Microsoft.Office.Tools.Word (in Microsoft.Office.Tools.Word.dll)
Syntax
'Declaration
Function MoveStart ( _
ByRef unit As Object, _
ByRef count As Object _
) As Integer
int MoveStart(
ref Object unit,
ref Object count
)
Parameters
- unit
Type: System.Object%
WdUnits . The unit by which start position of the specified range or selection is to be moved.
- count
Type: System.Object%
The maximum number of units by which the Bookmark control is to be moved. If Count is a positive number, the start position of the Bookmark control is moved forward in the document. If it is a negative number, the start position is moved backward. If the start position is moved forward to a position beyond the end position, the Bookmark control is collapsed and both the start and end positions are moved together. The default value is 1.
Return Value
Type: System.Int32
The number of units by which the start position of the Bookmark control actually moved, or it returns 0 (zero) if the move was unsuccessful.
Remarks
Optional Parameters
For information on optional parameters, see Optional Parameters in Office Solutions.
Examples
The following code example adds a Bookmark control with text to the first paragraph and then moves the start position of the bookmark.
This example is for a document-level customization.
Private Sub BookmarkMoveStart()
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(1).Range.Words(3), _
"Bookmark1")
MessageBox.Show("First word of bookmark prior to calling MoveStart: " _
& Bookmark1.Words.First.Text)
Bookmark1.MoveStart(Word.WdUnits.wdCharacter, 4)
MessageBox.Show("First word of bookmark prior to calling MoveStart: " _
& Bookmark1.Words.First.Text)
End Sub
private void BookmarkMoveStart()
{
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[1].Range.Words[3],
"bookmark1");
object Unit = Word.WdUnits.wdCharacter;
object Count = 3;
bookmark1.MoveStart(ref Unit, ref Count);
}
.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.