I have a macro in a Word document that generates a footer based on Bookmarks. It works, except for one detail: in one of the Ref-fields in the footer, the font is always incorrect after updating.
The size should be 6, like the rest of the footer, but is 9.5, like the original text. This only happens with one field. I've checked that the paragraph sign and the whole line are formatted properly. I've even copied one of the functions bookmarks and adapted them, but the font size is always wrong.
The problem arises on several computers.
I've given up solving the original problem because I'm running out of ideas. What I want now is to add to the macro some code that will apply a certain style (or font) to the footer.
What I've tried so far:
- I have created a Style for the footer (called footer1) - before that it was non-defined
- I have dabbled with VBA and googled for a few hours now to no avail.
- Disabling/Enabling mergefield switches in the Ref-field
- Google Search for "apply style to footer word vba"
ActiveDocument.Sections(ActiveDocument.Sections.Count) _ .Footers(1).Range.Style("footer1")
Here's the code:
ActiveDocument.Fields.Update ActiveDocument.Sections(ActiveDocument.Sections.Count) _ .Footers(1).Range.Fields.Update ' code needed here for changing footer's style to "footer1" ' Alternative: apply style only to faulty ref field.
Thanks for your help.
I can do minor adjustments to VBA macros in a pinch, but I'm no expert. I simply haven't found anything that I could adapt to my needs.