Word 2007 - put footer onto every new document when Word starts

T

Tony Harrison

Hi,
I've tried to find the solution to this, but to no avail.

In 2003 we modified the normal.dot so that every new document had the
filename and path in the footer.

In 2007 I have modified the normal.dotm and if I click the Office Button,
New, my templates, Normal then it works fine, but what I want is when the
user just opens Word that the footer already contains the footer.

I've got to roll this to 150 users so didn't want to modify each machine,
but can make changes in Group Policy or via the login script (to copy files
into locations, etc).

Any help is gratefully received
 
G

Graham Mayor

It is not a good idea to have a footer in the normal template. For a start
it prevents you from creating labels. Furthermore the filename field does
not update automatically and the document will not have a filename until the
document is saved. It would be better either to create a document template
containing the footer, which you can distribute via a shared workgroup
folder, or copy to the user's User Templates folder.
OR
My preferred method would be to use a macro to insert and update the
filename field in the footer. The following macro will insert the filename
and path in each footer of each section of the document after any existing
footer content. It will only insert the field once, and just updates the
field if already present.

Sub InsertFilenameInFooter()
Dim oSection As Section
Dim ofooter As HeaderFooter
Dim oRng As Range
Dim oFld As Field
ActiveDocument.Save
For Each oSection In ActiveDocument.Sections
For Each ofooter In oSection.Footers
Set oRng = ofooter.Range
With oRng
For Each oFld In oRng.Fields
If oFld.Type = wdFieldFileName Then
oFld.Update
Exit Sub
End If
Next oFld
If Len(oRng) > 1 Then
.InsertAfter vbCr
End If
.Start = ofooter.Range.End
.End = ofooter.Range.End
.Fields.Add oRng, wdFieldFileName, "\p", False
.ParagraphFormat.Alignment = wdAlignParagraphRight
.Font.Size = 8
.Fields.Update
End With
Next ofooter
Next oSection
End Sub

http://www.gmayor.com/installing_macro.htm

You could supply this macro in an add-in with a modified ribbon containing a
button command to run it - http://gregmaxey.mvps.org/Customize_Ribbon.htm

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
T

Tony Harrison

Thanks for the quick reply Graham.

I'm going to have to learn some commands here because for me, running your
macro simply saves the document. Nothing appears in word 2007 documents, and
certainly nothing in the footer stage. Obviously something with my set up or
something.

I'll step it through the debugger and see if I can see why mine is not
working.

BTW I went with option 2 - get a macro to do the hard work.

tony
 
G

Graham Mayor

I have just copied the code from the reply to Word 2007 and apart from
showing the field code rather than the result it saves the document and puts
the saved name and path in the footer in 8 point font. Do you have enough
footer space to insert it?

To fix the code display issue add the line
ActiveWindow.View.ShowFieldCodes = False
before End Sub.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
P

Peter T. Daniels

Note that adding the macro to the template won't affect already
existing documents based on that template, but only new documents
created from it.
 
T

Tony Harrison

That's the trick Graham - thanks. If I open (to view) the footer the code is
there.

Thanks for the help.
tony
 
G

Graham Mayor

Does it show in print preview?

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
G

Graham Mayor

In that case it is a display issue not attributable to the macro. I am not
sure what to suggest to resolve that.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top