At the moment they have to consider own headlines styles and textstructure styles. I'm using a function to detect those styles. I'm also using the "range" object instead of selection, because the user will change styles by selecting only the first line. If this line (Paragraph beginnig with 1.2) is selcted changed (eg by click on a button) i Loop to all paragraphs until the next concerned style occurs. In my example the Loop runs to the Paragraph beginning with "2". Now i can change the text of the Styleref Fields
Fixing the range:
Set ranActRange = ActiveDocument.Range(Start:=ActiveDocument.Paragra phs(intI).Range.Start, End:=ActiveDocument.Paragraphs(x - 1).Range.End)
x is the "For" counter of currently checked Paragraph. x-1 because Paragraph x is out of the concernd range that is supposed to be updated.
Now i can Change the fields as suggested exactly as in your method.
For Each fld In ranActRange.Fields
...
..
|