The purpose of this Microsoft Word Tips & Microsoft Word Help page is provide a VBA solution to automatic linked headers and footers. Sections in Word can be fickle (see InfoBit Blog ). One thing that I don't like about the built-in user interface for adding sections is the header and footer of any new section inserted is linked to the previous section header and footer by default and 'stays that way' without further user actions. As shown below, the header text in section two is linked by default to the header text in section one. While this feature is very handy for repeating header and footer information in subsequent sections, I think it becomes a nuisance when you want to change part or all of the header/footer text in your new sections. Microsoft Word Section Break HeaderStep 1, Open Microsoft Word. It's a blue app with a white 'W' on it. You can also open an existing document by double-clicking it.Step 2, Click Blank Document. This will open a new document in Word.Step 3, Click the Insert tab. You'll see it near the top of the Word window, directly to the right of the Home tab. Download whatsapp for nokia s40. To make different headers and footers for odd and even numbered pages, click the “Different Odd & Even Pages” check box in the “Options” section of the “Design” tab under the “Header & Footer Tools” heading so there is a check mark in the box. Microsoft Word Different Headers On Each PageDifferent Headers For Different Sections WordIn the illustration below I've started with a single section document containing header text and then added a section break. When adding the new section the header text in section one is automatically applied to the header text in section two. To further complicate matters, a Word document with sections is sort of like an old fashioned player piano sheet. While the section one header does not display 'Same as Previous,' the last section of a document (in our case section two) functions in effect as the previous section to section one. That is why when sections are linked, changes in subsequent sections can confusingly roll through a document changing other section's header and footer text. Using a VBA procedure in lieu of a the user interface, you can create a section break and carry over the previous section text. However, once the section and carry over text is created the link is broken. This allows you to make changes in the new header or footer that won't affect the header and footer of the previous section. Option Explicit Dim i As Long Dim j As Long Dim oDoc As Word.Document Sub AddSectionAndKillLinkToPrevious() Dim myRng As Word.Range Set oDoc = ActiveDocument Selection.InsertBreak Type:=wdSectionBreakNextPage 'Get the index number of the added section i = oDoc.Range(0, Selection.Sections(1).Range.End).Sections.Count With oDoc.Sections(i) For j = 1 To 3.Headers(j).LinkToPrevious = False. Fl studio 10 0 9c producer edition final activated charcoal powder. Footers(j).LinkToPrevious = False Next j End With 'Note: j provides the constant value to unlink all three header footer types. Lbl_Exit: Exit Sub End Sub Sub RelinkSections() Dim myRng As Word.Range Set oDoc = ActiveDocument For i = 1 To oDoc.Sections.Count With oDoc.Sections(i) For j = 1 To 3.Headers(j).LinkToPrevious = True.Footers(j).LinkToPrevious = True Next j End With Next i lbl_Exit: Exit Sub End Sub Notes: 1. The procedure RelinkSections is provided in case you should want to quickly relink all sections in your document.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |