Forum Discussion

JeremyBaj's avatar
JeremyBaj
Copper Contributor
Sep 21, 2025

In Microsoft Word headers, how do I enter content that differs on each page without section breaks?

I am currently finishing up a daily devotional book -- that is, a book that has one page for each day of the year (in this case including February 29th for leap years). I need a header that contains unchanging content (the name of the book), and two predictably variating items: the day of the year, and a running number of days. For example:

Crumbs ~ February 01 / Day 32
Crumbs ~ February 02 / Day 33

I am hoping to find a way to feed a formula into the Word header that will cooperate (even with the February 29th issues). It is important that the header remain consistent in this upward count--even if I move some of the pages back or forth. I also want to avoid including a section break at the end of each page.

Does anyone have any ideas of how to make this work?  

5 Replies

  • cdrgreg's avatar
    cdrgreg
    Copper Contributor

    Well from reading the previous replies, it should be obvious that you simply can't have unique headers on each page of a document without using section breaks.

    Can I assume that your devotional book is finished.  I mean that you have a document containing 365 pages (one page per day)?  If yes, the following may meet your requirements:

     

    The macro loops through each page of the document and inserts a textbox (that appears to be in the header) and serves as a unique header for each page.  Now, the problem is if your book isn't actually finished and you start moving text around, adding text or deleting text, then these textboxes will be relocated (and out of place).  In that case you will have to run the ScrollByPage procedure again.

     



    Option Explicit
    Sub ScrollByPage()
    Dim oPage As Page
    Dim oStart As Range
    Dim oShp As Shape
    Dim lngIndex As Long
      'Scrolls document by page and inserts a unique pseudo header on each page.
      'Delete any existing pseudo headers
      For lngIndex = ActiveDocument.Shapes.Count To 1 Step -1
        Set oShp = ActiveDocument.Shapes(lngIndex)
        If InStr(oShp.Name, "DTB") = 1 Then
          oShp.Delete
        End If
      Next
      Set oStart = ActiveDocument.Range(0, 0)
      For Each oPage In ActiveDocument.ActiveWindow.ActivePane.Pages
          oPage.Rectangles(1).Range.Select
          Selection.Collapse wdCollapseStart
          DoEvents
          AddTextboxAndAssignToShape
      Next oPage
      oStart.Select
    lbl_Exit:
      Exit Sub
    End Sub
    Sub AddTextboxAndAssignToShape()
    Dim shpTextBox As Shape
      Set shpTextBox = ActiveDocument.Shapes.AddTextbox(Orientation:=msoTextOrientationHorizontal, _
                                                        Left:=70, Top:=25, Width:=200, Height:=25)
      shpTextBox.Name = "DTB" & ActiveDocument.Shapes.Count
      With shpTextBox
        .TextFrame.TextRange.Text = "Crumbs ~ " & Format(DateAdd("d", Selection.Information(wdActiveEndPageNumber) - 1, Year(Now) & "/1/1"), "MMMM dd") & " / Day " & Selection.Information(wdActiveEndPageNumber)
        .Line.Visible = msoFalse
      End With
    lbl_Exit:
      Exit Sub
    End Sub

  • SaithIbraheem's avatar
    SaithIbraheem
    Copper Contributor

    Good question! In Word, you can use the ‘Different First Page’ option under Header & Footer Tools, and for more control, insert section breaks. Each section can then have its own unique header or footer. This way, you don’t have to manually adjust every page.

  • I would create a data source in Excel that has a column for each of the fixed text, the Date and the Day number as it is very easy to populate those fields with the required data in Excel.

    Then, create a letters type mail merge main document that contains at the top of each page (NOT in the header) the MERGEFIELD fields for the fixed test, the Date and the Day number and then use the Edit Individual Documents destination for the Merge. 

    You will then get a document containing a page for each day with the required information at the top of each page.

  • Charles_Kenyon's avatar
    Charles_Kenyon
    Bronze Contributor

    Often, the StyleRef Field will solve this problem. But, it requires that the text be somewhere in the body of the page.

    Other than styleref and page numbering fields, fields in headers generally stay constant. You could have the dates as fields in the body of the document, perhaps even placed in Frames or TextBoxes to look like they are in the header. Date calculations and fields can be quite complex. See MVP Paul Edstein's Microsoft Word Date Calculation Tutorial for sample fields to meet various requirements. Please read the introductory material before trying to use any of the fields from the tutorial. You may be able to copy a field from the tutorial and place it in your book.

    If in the header, your resulting field would need to be based, to some extent on the page field to get sequential numbering.

    Using a section break for each page will make your document a real headache to edit.

  • TTAMungo's avatar
    TTAMungo
    Brass Contributor

    Hi JeremyBaj

    unfortunately, word doesn’t have a built-in way to do exactly what you want (a unique header on every page that automatically updates without section breaks). By design, headers and footers repeat until you insert a section break. That’s why Word isn’t a great fit for page-by-page variations like your devotional.

    Here are some workarounds you could try:

    • Use fields inside the body text instead of the header
      • You can insert fields like PAGE, SEQ (sequence numbers), or even DATE fields into the main document text.
      • Then, use formatting so this text looks like a header (smaller font, positioned at the top). This way, each page shows different information, but you’re not relying on the header itself.
    • Consider “Different First Page” + Section Breaks (traditional way)
      • This is the usual Word method: each section can have its own header. But like you said, that means 366 section breaks for a leap year.
    • Work with fields and calculations
      • Word fields can do basic calculations. For example, you could use a SEQ field to number your days (Day 32, Day 33, etc.).
      • However, automating “February 1 → Day 32” and rolling over into leap years is very tricky inside Word alone, it doesn’t have the same formula power as Excel.
    • Alternative tools
      • If the project is book-length and needs precise daily headers, you might consider doing the layout in Publisher, InDesign. Those programs give you much more control for repeating structures across hundreds of pages.
    • Another option is to generate the daily headers in Excel (dates + day counts) and then mail merge into Word. That way, each page gets the right header without manual section breaks.

Resources