Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-01-2020, 11:30 AM
George Pond George Pond is offline Author wants to tag and retrieve dialog for a character Windows 10 Author wants to tag and retrieve dialog for a character Office 2019
Novice
Author wants to tag and retrieve dialog for a character
 
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
Reply



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 07:58 PM.


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