From: Tony Harrison on
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

"Graham Mayor" wrote:

> 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
>
> My web site www.gmayor.com
> Word MVP web site http://word.mvps.org
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>
>
> "Tony Harrison" <TonyHarrison(a)discussions.microsoft.com> wrote in message
> news:0866837F-7A65-44B7-B2F5-C064677B78CC(a)microsoft.com...
> > 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
>
>
> .
>
From: Graham Mayor on
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

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


"Tony Harrison" <TonyHarrison(a)discussions.microsoft.com> wrote in message
news:BC91E6EB-5E8A-4005-BF0A-4B55A7E8ABFE(a)microsoft.com...
> 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
>
> "Graham Mayor" wrote:
>
>> 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
>>
>> My web site www.gmayor.com
>> Word MVP web site http://word.mvps.org
>> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>>
>>
>> "Tony Harrison" <TonyHarrison(a)discussions.microsoft.com> wrote in message
>> news:0866837F-7A65-44B7-B2F5-C064677B78CC(a)microsoft.com...
>> > 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
>>
>>
>> .
>>


From: Peter T. Daniels on
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.

On Jun 1, 1:47 am, "Graham Mayor" <gma...(a)REMOVETHISmvps.org> wrote:
> 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
>
> My web sitewww.gmayor.com
> Word MVP web sitehttp://word.mvps.org
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>
> "Tony Harrison" <TonyHarri...(a)discussions.microsoft.com> wrote in message
>
> news:BC91E6EB-5E8A-4005-BF0A-4B55A7E8ABFE(a)microsoft.com...
>
>
>
> > 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
>
> > "Graham Mayor" wrote:
>
> >> 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
>
> >> My web sitewww.gmayor.com
> >> Word MVP web sitehttp://word.mvps.org
> >> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>
> >> "Tony Harrison" <TonyHarri...(a)discussions.microsoft.com> wrote in message
> >>news:0866837F-7A65-44B7-B2F5-C064677B78CC(a)microsoft.com...
> >> > 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
From: Tony Harrison on
That's the trick Graham - thanks. If I open (to view) the footer the code is
there.

Thanks for the help.
tony

"Graham Mayor" wrote:

> 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
>
> My web site www.gmayor.com
> Word MVP web site http://word.mvps.org
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>
>
> "Tony Harrison" <TonyHarrison(a)discussions.microsoft.com> wrote in message
> news:BC91E6EB-5E8A-4005-BF0A-4B55A7E8ABFE(a)microsoft.com...
> > 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
> >
> > "Graham Mayor" wrote:
> >
> >> 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
> >>
> >> My web site www.gmayor.com
> >> Word MVP web site http://word.mvps.org
> >> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> >>
> >>
> >> "Tony Harrison" <TonyHarrison(a)discussions.microsoft.com> wrote in message
> >> news:0866837F-7A65-44B7-B2F5-C064677B78CC(a)microsoft.com...
> >> > 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
> >>
> >>
> >> .
> >>
>
>
> .
>
From: Graham Mayor on
Does it show in print preview?

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

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


"Tony Harrison" <TonyHarrison(a)discussions.microsoft.com> wrote in message
news:35F41747-D882-4263-8AAD-D39F48709819(a)microsoft.com...
> That's the trick Graham - thanks. If I open (to view) the footer the code
> is
> there.
>
> Thanks for the help.
> tony
>
> "Graham Mayor" wrote:
>
>> 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
>>
>> My web site www.gmayor.com
>> Word MVP web site http://word.mvps.org
>> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>>
>>
>> "Tony Harrison" <TonyHarrison(a)discussions.microsoft.com> wrote in message
>> news:BC91E6EB-5E8A-4005-BF0A-4B55A7E8ABFE(a)microsoft.com...
>> > 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
>> >
>> > "Graham Mayor" wrote:
>> >
>> >> 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
>> >>
>> >> My web site www.gmayor.com
>> >> Word MVP web site http://word.mvps.org
>> >> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>> >>
>> >>
>> >> "Tony Harrison" <TonyHarrison(a)discussions.microsoft.com> wrote in
>> >> message
>> >> news:0866837F-7A65-44B7-B2F5-C064677B78CC(a)microsoft.com...
>> >> > 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
>> >>
>> >>
>> >> .
>> >>
>>
>>
>> .
>>


 |  Next  |  Last
Pages: 1 2
Prev: Word 97 file won't open.
Next: Document Templates