Bookmark.GoToEditableRange Method (Object)

 

Gets a Range object that represents an area of a Bookmark control that can be modified by the user or group of users.

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

Range GoToEditableRange(
	ref object EditorID
)

Parameters

EditorID
Type: System.Object

Can be a string that represents the e-mail alias of the user (if in the same domain), an e-mail address, or a T:Microsoft.Office.Interop.Word.WdEditorType constant that represents a group of users. If omitted, selects all ranges for which all users have permissions to edit.

Return Value

Type: Microsoft.Office.Interop.Word.Range

A Range object that represents an area of a Bookmark control that can be modified by the user or group of users.

For information on optional parameters, see Optional Parameters in Office Solutions.

The following code example adds a Bookmark control with text to the first paragraph in the document and adds all users as editors of the fourth word in the bookmark. The example then protects the document against revisions. Finally, the code displays the editable range of the bookmark in a message box.

This example is for a document-level customization.

private void BookmarkEditors()
{
    object editor = Word.WdEditorType.wdEditorEveryone;
    this.Paragraphs[1].Range.InsertParagraphBefore();
    Microsoft.Office.Tools.Word.Bookmark bookmark1 =
        this.Controls.AddBookmark(this.Paragraphs[1].Range,
        "bookmark1");
    bookmark1.Text = "This text cannot be edited.";
    bookmark1.Words[4].Editors.Add(ref editor);
    this.Protect(Word.WdProtectionType.wdAllowOnlyReading,
        ref missing, ref missing, ref missing, ref missing);

    Word.Range range1 = bookmark1.GoToEditableRange(ref editor);

    if (range1 != null)
    {
        MessageBox.Show("The editable Range of bookmark1 spans from " +
            range1.Start.ToString() + " to " + range1.End.ToString());
    }
}
Return to top
Show: