none
track changes deleted content control showing in count RRS feed

  • Question

  • I have a content control inserted which is deleted by the user with track changes turned on. I have a function which uses content controls. The deleted content control keeps showing in the count or content controls iteration.

    This is the first stage where there is a content control and shows in the count.

    As you can see here, the content control is deleted yet it is showing in the count.

    For text part to prevent showing deleted text in macro like selection.text, we keep the review view to final and it wont return deleted text. Similarly I tried to change the view to Final and tried, still it is showing in count.

    Note: I want to retain the deleted content control since it must be accepted/rejected only in the production department and not in automation. So accept all changes is not an option for me. Is there a way to prevent deleted content control showing up in the iteration of range.contentcontrols or is there a property to find that the content control is deleted. I would prefer a solution for first option since it wont require me to re-write all the functions we had written so far.

    Thank You,

    Sriram

    Wednesday, December 11, 2013 5:36 AM

Answers

  • That behaviour is normal, not only with content controls, but with many other document elements pending acceptance/rejection of the changes. If you want to exclude 'deleted' controls from the count, you need to test whether they're in a revisions deletion range and, if so, skip them. For example, to work with the 5th 'non-deleted' content control:

    Sub Demo()
    Dim i As Long, j As Long
    With ActiveDocument
      For i = 1 To .ContentControls.Count
        With .ContentControls(i).Range.Revisions
          If .Count <> 0 Then
            If .Item(1).Type <> wdRevisionDelete Then j = j + 1
            If j = 5 Then
              'Do something
              Exit For
            End If
          End If
        End With
      Next
    End With
    End Sub


    Cheers
    Paul Edstein
    [MS MVP - Word]


    Friday, December 13, 2013 7:13 AM