Hey Guys,
I've created a custom style guide with the name "Tag". I marked some parts of my document with this tag(a entire paragraph, a word or just a character). My purpose is to find all text parts, that are marked with my tag. I found a code snippet on the web , but it lists only paragraphs, that are marked with the tag. So, if I mark just a word or a character, they won't be listed.
Sub FindStyle()
Dim sty As Style
Set sty = ActiveDocument.Styles("Tag")
Dim rng As Range
Set rng = ActiveDocument.Content
Dim txt As String
With rng.Find
.Text = ""
.Style = sty
.Execute
Do While .Found = True
MsgBox rng.Text
.Execute
Loop
End With
MsgBox txt
End Sub
Is there an other approach to find words or even characters that are marked with the style guide? I've spent already several hours with looking for a solution - I'm desperate I'm new to VBA I appreciate any help.
Thanks a lot!
Konstantin