none
Highlighting Tracked Changes RRS feed

  • Question

  • I have a calendar control on two seperate userforms, one selects the start date and the other selects an end date. I would like it if i could select two dates (ex. Aug 1, 2011 and Aug 5, 2011) and it would highlight all revisions within that time fram to be yellow including the ones on the 1st and the 5th. Dont know why this code isnt working right: Plase help (DatePick is the name of the starting date form, DatePick2 is the ending date form)

        For Each rev In doc.Revisions
         
          If rev.Date <= DatePick2.Calendar1.value Then
            If rev.Date >= DatePick.Calendar1.value Then
              rev.Range.Select
              selection.Range.HighlightColorIndex = wdYellow
              n = n + 1
            End If
          End If
         
          If rev.Date = DatePick.Calendar1.value Then
            rev.Range.Select
            selection.Range.HighlightColorIndex = wdYellow
            x = x + 1
          ElseIf rev.Date = DatePick2.Calendar1.value Then
            rev.Range.Select
            selection.Range.HighlightColorIndex = wdYellow
            y = y + 1
          End If
         
        Next

    Monday, August 1, 2011 8:36 PM