Davecogz84
09-07-2018, 06:58 PM
Hello,
I need to apply a single style (called "Header titling") to all headers and header styles already in the document.
At the moment, the authors of the documents I receive create a large number of headings with no consistent style. For example, the document I'm working on now is two pages, but has "Header"; "Header or footer (3)" (twice-once with para changes, other with only font changes); "Heading #1 (2)" (twice-once with para changes, other with only font changes); "Heading 1".
I would like to apply a single style to all these many variants of headings and headers. I guess there are two stages to this process:
(1) Finding all the headings and headers
(2) Applying the style to them
I do this to replace each individual style:
With Selection.Find
.ClearFormatting
.Style = ActiveDocument.Styles("Header or footer")
.Replacement.ClearFormatting
.Replacement.Style = ActiveDocument.Styles("Normal titling")
.Forward = True
.Wrap = wdFindContinue
.Format = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
The trouble is that I don't know how to find what headers and headings are used in the document and couldn't find anything useful for this. Any help would be much appreciated!
I need to apply a single style (called "Header titling") to all headers and header styles already in the document.
At the moment, the authors of the documents I receive create a large number of headings with no consistent style. For example, the document I'm working on now is two pages, but has "Header"; "Header or footer (3)" (twice-once with para changes, other with only font changes); "Heading #1 (2)" (twice-once with para changes, other with only font changes); "Heading 1".
I would like to apply a single style to all these many variants of headings and headers. I guess there are two stages to this process:
(1) Finding all the headings and headers
(2) Applying the style to them
I do this to replace each individual style:
With Selection.Find
.ClearFormatting
.Style = ActiveDocument.Styles("Header or footer")
.Replacement.ClearFormatting
.Replacement.Style = ActiveDocument.Styles("Normal titling")
.Forward = True
.Wrap = wdFindContinue
.Format = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
The trouble is that I don't know how to find what headers and headings are used in the document and couldn't find anything useful for this. Any help would be much appreciated!