View Single Post
 
Old 02-02-2018, 01:29 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

I'd be surprised if any of the footer content was correct with that code - as posted all you'd end up with in the footer is ' af ', since:
Code:
.Footers(wdHeaderFooterPrimary).Range.Text = " af "
overwrites whatever is already there and:
Code:
.Footers(wdHeaderFooterPrimary).Range.Fields.add Selection.Range
adds the field to whatever is selected - which is probably not in the footer.

Try:
Code:
Public Sub headerFooter(f As Form, bD As Word.Document)
    With bD.Sections(1)
        .Headers(wdHeaderFooterPrimary).Range.Text = "Alle registrerede data vedr. PersonId: " & f.PersonID & " " & HentFMENavn(f.PersonID)
        With .Footers(wdHeaderFooterPrimary).Range
            .Text = "Sammensat " & StrConv(Format(Date, "dddd"), vbProperCase) & " den " & Date & vbTab & vbTab & "Side "
            .Fields.Add .Characters.Last, wdFieldEmpty, "PAGE", False
            .InsertAfter " af "
            .Fields.Add .Characters.Last, wdFieldEmpty, "NUMPAGES", False
        End With
    End With
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote