Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #6  
Old 02-28-2020, 11:57 PM
macropod's Avatar
macropod macropod is offline Author wants to tag and retrieve dialog for a character Windows 7 64bit Author wants to tag and retrieve dialog for a character Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
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
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Detecting that previous character doesn't exist (i.e., present character is first in document) Robert K S Word VBA 15 08-01-2016 09:33 AM
Author wants to tag and retrieve dialog for a character Replace a random character with the same character RickLegrand Word 7 07-23-2015 06:35 PM
Author wants to tag and retrieve dialog for a character How can select from a specific character to another character mohsen.amiri Word 2 02-19-2015 11:38 PM
Author wants to tag and retrieve dialog for a character Track Changes Author Not Showing UP ronksmith Word 1 05-19-2012 10:35 AM
Author wants to tag and retrieve dialog for a character Where can I see the Word2007 doc properties (author,...)? pstein Word 1 03-26-2012 03:01 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:13 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft