Share via


Bookmark.Editors Property

Definition

Gets an Editors object that represents all the users authorized to modify a Bookmark control within a document.

public:
 property Microsoft::Office::Interop::Word::Editors ^ Editors { Microsoft::Office::Interop::Word::Editors ^ get(); };
public Microsoft.Office.Interop.Word.Editors Editors { get; }
member this.Editors : Microsoft.Office.Interop.Word.Editors
Public ReadOnly Property Editors As Editors

Property Value

An Editors object that represents all the users authorized to modify a Bookmark control within a document.

Examples

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 and 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());
    }
}
Private Sub BookmarkEditors()

    Dim editor As Object = Word.WdEditorType.wdEditorEveryone
    Me.Paragraphs(1).Range.InsertParagraphBefore()
    Dim Bookmark1 As Microsoft.Office.Tools.Word.Bookmark = _
        Me.Controls.AddBookmark(Me.Paragraphs(1).Range, "Bookmark1")

    Bookmark1.Text = "This text cannot be edited."
    Bookmark1.Words(4).Editors.Add(editor)
    Me.Protect(Word.WdProtectionType.wdAllowOnlyReading)

    Dim range1 As Word.Range = Bookmark1.GoToEditableRange(editor)

    If Not (range1 Is Nothing) Then
        MessageBox.Show("The editable Range of Bookmark1 spans from " _
            & range1.Start.ToString & " to " & range1.End.ToString)
    End If

End Sub

Applies to