Word VBA: Finding text with a particular color.

Can someone give me code to get the font color at the current cursor position and then look for the next text with the same color?
LVL 43
Saqib Husain, SyedEngineerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


pls try
Sub Macro()
With Selection
    lngCol = .Font.Color
    With .Find
        .Font.Color = lngCol
        .Text = ""
        .Forward = True
        .Format = True
    End With
End With

End Sub

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
HuaMin ChenProblem resolverCommented:
Here is an example to get font color

Worksheets("Code Sheet").Cells(i, 1).Font.Color

Open in new window

Here is one other example to find out one specific string

    Set c1 = Worksheets("Code Sheet3").Cells.Find(Para_Country)

    If Not c1 Is Nothing Then
        Worksheets("Budget-Report-HO").Cells(3, 5).Value = Worksheets("Code Sheet3").Cells(c1.Row, 2).Value
        Exit Sub
    End If

Open in new window

@HuaMinChen Word VBA not Excel VBA
Introduction to Web Design

Develop a strong foundation and understanding of web design by learning HTML, CSS, and additional tools to help you develop your own website.

Saqib Husain, SyedEngineerAuthor Commented:
Just perfect, thanks.
Word or Excel I'm confused...
Saqib Husain, SyedEngineerAuthor Commented:
Sorry, wrong answer accepted. I cannot find the request attention button.
Maybe the flag "report"
Saqib Husain, SyedEngineerAuthor Commented:
Yes, I already did that.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Word

From novice to tech pro — start learning today.