Forum Discussion
Mehmetbukum
Oct 24, 2022Copper Contributor
get list a spesicif style text
The sentences written in the Arabic alphabet marked in the photo were created with the style called "farsca_cumle". Is it possible to list only the sentences defined with this style at the end ...
Mehmetbukum Try using
Dim RngFound As Range, DocRange As Range
Set DocRange = ActiveDocument.Range
Selection.HomeKey wdStory
Selection.Find.ClearFormatting
Selection.Find.Style = "farsca_cumle"
With Selection.Find
Do While .Execute(FindText:="", MatchWildcards:=False, Wrap:=wdFindContinue, Forward:=True) = True
Set RngFound = .Selection.Range
If RngFound.End < DocRange.End Then
ActiveDocument.Range.InsertAfter RngFound.Text & vbCr
Selection.Collapse wdCollapseEnd
Else
Exit Sub
End If
Loop
End With
Mehmetbukum
Oct 24, 2022Copper Contributor
Doug_Robbins_Word_MVP unfortunately the code gave an error at "Set RngFound = .Selection.Range"
error: method or data member not found