View Single Post
 
Old 02-28-2020, 11:57 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by George Pond View Post
As author, I would like to tag Jimmy's speech with "Jimmy", and Janey's speech with "Janey". Later I would like to be able to retrieve all of Jimmy's speech in one place.
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.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote