![]() ![]() Section 3 is for the copyright blurb and this has a very strange header and a cut-down footer.Īll footers contain the Version custom document property. Section 2 is for the body of the document and has headers and footers. Subsequent pages have page numbering in roman numerals for the TOC. Section 1 is for the title page and TOC so the first page of that section has no header/footer but does use the Version property on it. The challenging document that seems to cause the most problems is structured like this: It currently does quite a good job, handling TOCs and TOAs an TOFs etc, it just seems to skip footers (sometimes) in a multi-section document for example. Then change the property and invoke the macro. Remember to make a multi-section document with different header/footers. Headers, Footers, first-page, subsequent page etc. Then use that field in as many places as you can. To test, create a word document and add a custom field named Version and give it a value. I have built this macro over a number of years and several bouts of research but I am not proud of it so please suggest a complete replacement if there is now a clean way of doing it. Today it missed First page footer -section 2- because the document version was not updated. I have noticed recently that it sometimes misses some secions of the document. 'Update only the fields in your footer like:įor Each header In ActiveDocument.Sections().Headers() ![]() I = ActiveDocument.BuiltInDocumentProperties(14)įor Each footer In ActiveDocument.Sections().Footers() While Not (rngStory.NextStoryRange Is Nothing) If rngStory.StoryType wdMainTextStory Then ![]() If rngStory.StoryType = wdCommentsStory Then ' Loop through each story in doc to update I invoke this macro before releasing the document for review to ensure all headers and footers etc are correct.Ĭurrently - it look like this: Sub UpdateAllFields()ĭim doc As Document ' Pointer to Active Documentĭim wnd As Window ' Pointer to Document's Windowĭim lngMain As Long ' Main Pane Type Holderĭim lngActPane As Long ' ActivePane Numberĭim rngStory As Range ' Range Objwct for Looping through Storiesĭim TOC As TableOfContents ' Table of Contents Objectĭim TOA As TableOfAuthorities 'Table of Authorities Objectĭim TOF As TableOfFigures 'Table of Figures Object I have built - over the years - a vba macro that is supposed to update all fields in a word document. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2022
Categories |