View Single Post
 
Old 10-09-2023, 05:23 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,176
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

This will get you started.
Code:
Sub ShowDups()
  Dim aPar As Paragraph, sStart As String
  On Error Resume Next
  For Each aPar In ActiveDocument.Paragraphs
    If aPar.Range.Characters(2).Text = vbTab Then
      If Left(aPar.Range.Text, 2) = Left(aPar.Next.Range.Text, 2) Then
        aPar.Next.Range.HighlightColorIndex = wdBrightGreen
      End If
    End If
  Next aPar
End Sub
I put the error resume in because the loop would fail when looking for the paragraph after the last paragraph (and I couldn't be bothered complicating the code to deal with that).
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote