Below macro is supposed to bookmark paragraphs a certain way where a user-defined style (user-style) has been applied.
The code does not find any paragraph where the user-defined style (user-style) has been applied. What is wrong with this code?
Help is much appreciated. Thank you very much in advance.
Dim strLanguages As Variant
Dim i As Long
Dim frange As Range
i = 0
Selection.Find.Style = ActiveDocument.Styles("user-style")
strLanguages = Array("de", "en", "es", "fr", "it")
Do While .Execute(FindText:="", Forward:=True, _
MatchWildcards:=False, Wrap:=wdFindStop, MatchCase:=False) = True
Set frange = Selection.Range
ActiveDocument.Bookmarks.Add "MainTOC_" & strLanguages(i), frange
i = i + 1