change/append all ms word header/footer text via vba
Posted on 2008-06-09
I'm looking for how to do the following via VBA (in VB).
I want to:
(a) Get the existing header and footer, more specifically the very first header/footer set in a document (preserving any formatting, i.e., bolding/etc)
(b) Change ALL headers to be only ONE header (i.e., the first header I extracted), this is true for footers as well (so if there were 5 different headers in a document, they would all be set to just one)
(c) And also to be able to 'append' a header to all existing headers (doesn't matter if different header text, it would be appended to the existing header present on a certain page).
I know I have to do something with
ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).Range = "something",
but not exactly sure what to do.