Welcome.
Sir, please tell me how to get an array of words and their initial positions in the document with only the font style?
That is, we have a document with as far as styles.
we highlight one of the words, and we want to get all the words that have the same style.
Trying to describe the right.
Code:
Sub Style_work()
Dim S As String
S = Selection.Text
Dim style_1 As Word.Style
style_1 = Selection.style
If VBA.Len(S) <= 0 Then Exit Sub
With ActiveDocument.Find (ActiveDocument=Selection)
.style = style1
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
ActiveDocument.Find.Execute
End Sub
Thank you for your help.
Anton