View Single Post
 
Old 03-01-2020, 11:30 AM
George Pond George Pond is offline Windows 10 Office 2019
Novice
 
Join Date: Feb 2020
Location: Orlando, Florida
Posts: 4
George Pond is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
Well, if you colour each person's speeches, a macro could be used to create a list of them by speaker. A simple example:
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim StrOut As String
With ActiveDocument.Range
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Font.ColorIndex = wdBlue
    .Text = ""
    .Replacement.Text = ""
    .Format = True
    .Forward = True
    .Wrap = wdFindStop
    .Execute
  End With
  Do While .Find.Found
    StrOut = StrOut & vbCr & .Text
    If .Information(wdWithInTable) = True Then
      If .End = .Cells(1).Range.End - 1 Then
        .End = .Cells(1).Range.End
        .Collapse wdCollapseEnd
        If .Information(wdAtEndOfRowMarker) = True Then
          .End = .End + 1
        End If
      End If
    End If
    If .End = ActiveDocument.Range.End Then Exit Do
    .Collapse wdCollapseEnd
    .Find.Execute
  Loop
End With
Application.ScreenUpdating = True
If StrOut = "" Then StrOut = "Nothing"
MsgBox "Found: " & StrOut
End Sub
The above code simply captures all standard blue text and displays it in a message box. More complex code could be used to accept user input for RGB colours (but then it's be your responsibility to keep track of what you've used - and to use them consistently.
Thank you for taking the time to reply! I was blown-away by the creative solutions, and so quickly. I wound up using paragraph styles and a custom TOC, which is working well for me.
Reply With Quote