View Single Post
 
Old 10-21-2017, 07:03 AM
datech-hh datech-hh is offline Windows 10 Office 2016
Novice
 
Join Date: Oct 2017
Posts: 9
datech-hh is on a distinguished road
Default

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
...
..
Reply With Quote