none
Editors in Word RRS feed

  • Question

  • How Can we remove all the Editors(edit every one ) in Word.

    i have code for this but  it is not Removing the Editors which are present inside Floating items like text box or a Content control.

     

    Do While (ActiveDocument.Range.GoToEditableRange(wdEditorEveryone) Is Nothing) = False

    ActiveDocument.Range.GoToEditableRange(wdEditorEveryone).Select

    Selection.Editors(wdEditorEveryone).Delete

    Loop

     

    please help.

    Wednesday, June 8, 2011 11:48 AM

Answers

  • Try:

     

    Public Sub Suggestion()
    Dim rngStory As Word.Range
    Dim lngJunk As Long
    Dim oShp As Shape
    lngJunk = ActiveDocument.Sections(1).Headers(1).Range.StoryType
    For Each rngStory In ActiveDocument.StoryRanges
      'Iterate through all linked stories
      Do
        On Error Resume Next
        DeleteEditors rngStory
        Select Case rngStory.StoryType
          Case 6, 7, 8, 9, 10, 11
            If rngStory.ShapeRange.Count > 0 Then
              For Each oShp In rngStory.ShapeRange
                If oShp.TextFrame.HasText Then
                   DeleteEditors rngStory
                End If
              Next
            End If
          Case Else
            'Do Nothing
        End Select
        On Error GoTo 0
        'Get next linked story (if any)
        Set rngStory = rngStory.NextStoryRange
      Loop Until rngStory Is Nothing
    Next
    End Sub
    Sub DeleteEditors(ByRef oRng As Word.Range)
    Dim oEditRng As Word.Range
    Do While (oRng.GoToEditableRange(wdEditorEveryone) Is Nothing) = False
      Set oEditRng = oRng.GoToEditableRange(wdEditorEveryone)
      oEditRng.Editors(wdEditorEveryone).Delete
    Loop
    End Sub


    Greg Maxey Please visit my website at: http://gregmaxey.mvps.org/word_tips.htm
    Wednesday, June 8, 2011 12:11 PM
  • Hi Greg,

    Thanks for your helps.

     

    Hi dexter,

     

    Please take the code provided by Greg into a try to see if it can solve your problem.

     

    In addition, here is a similar thread which maybe you will interest in:

    Remove all editors from a word document

     

    I hope this helps.


    Best Regards, Calvin Gao [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, June 10, 2011 8:59 AM
    Moderator

All replies

  • Try:

     

    Public Sub Suggestion()
    Dim rngStory As Word.Range
    Dim lngJunk As Long
    Dim oShp As Shape
    lngJunk = ActiveDocument.Sections(1).Headers(1).Range.StoryType
    For Each rngStory In ActiveDocument.StoryRanges
      'Iterate through all linked stories
      Do
        On Error Resume Next
        DeleteEditors rngStory
        Select Case rngStory.StoryType
          Case 6, 7, 8, 9, 10, 11
            If rngStory.ShapeRange.Count > 0 Then
              For Each oShp In rngStory.ShapeRange
                If oShp.TextFrame.HasText Then
                   DeleteEditors rngStory
                End If
              Next
            End If
          Case Else
            'Do Nothing
        End Select
        On Error GoTo 0
        'Get next linked story (if any)
        Set rngStory = rngStory.NextStoryRange
      Loop Until rngStory Is Nothing
    Next
    End Sub
    Sub DeleteEditors(ByRef oRng As Word.Range)
    Dim oEditRng As Word.Range
    Do While (oRng.GoToEditableRange(wdEditorEveryone) Is Nothing) = False
      Set oEditRng = oRng.GoToEditableRange(wdEditorEveryone)
      oEditRng.Editors(wdEditorEveryone).Delete
    Loop
    End Sub


    Greg Maxey Please visit my website at: http://gregmaxey.mvps.org/word_tips.htm
    Wednesday, June 8, 2011 12:11 PM
  • Hi Greg,

    Thanks for your helps.

     

    Hi dexter,

     

    Please take the code provided by Greg into a try to see if it can solve your problem.

     

    In addition, here is a similar thread which maybe you will interest in:

    Remove all editors from a word document

     

    I hope this helps.


    Best Regards, Calvin Gao [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, June 10, 2011 8:59 AM
    Moderator