The easiest solution would seem to set up a template for this. But if you
want to do it in VBA, the following variation on your code works:
Sub test()
Dim i As Integer
For i = 1 To ActiveDocument.Sections.Count
With ActiveDocument.Sections(i)
.Footers(wdHeaderFooterFirstPage).Range.Delete
ActiveDocument.Fields.Add _
Range:=.Footers(wdHeaderFooterFirstPage).Range, _
Type:=wdFieldEmpty, Text:= _
"FILENAME \* Lower ", PreserveFormatting:=True
.Footers(wdHeaderFooterPrimary).Range.Delete
ActiveDocument.Fields.Add _
Range:=.Footers(wdHeaderFooterFirstPage).Range, _
Type:=wdFieldEmpty, Text:= _
"FILENAME \* Lower ", PreserveFormatting:=True
.Footers(wdHeaderFooterPrimary).PageNumbers.Add _
PageNumberAlignment:=wdAlignPageNumberCenter, FirstPage:=False
End With
Next i
End Sub
Note that when you add a field, you can use any Fields collection (I used
ActiveDocument.Fields just to make the line a bit shorter), but the Range
parameter of the Add method must carefully reference the Range object to
which you are adding the field. (In particular, you cannot use
Selection.Range.)

Signature
Stefan Blom
Microsoft Word MVP
> Hello,
>
[quoted text clipped - 27 lines]
>
> CAN YOU HELP? THANKS A LOT
Sammy - 06 Nov 2007 21:58 GMT
Thanks for your help! Okay, I tried it, but it's omitting the filename from
all pages in the section except for the 1st page. In your code it looks like
the filename should be appearing on every page, but it's not. Thanks
> The easiest solution would seem to set up a template for this. But if you
> want to do it in VBA, the following variation on your code works:
[quoted text clipped - 59 lines]
> >
> > CAN YOU HELP? THANKS A LOT
Stefan Blom - 07 Nov 2007 10:47 GMT
Sorry, it seems as if I didn't read your initial post carefully enough... My
suggestion only inserts the file name in the first page header. The good news
is that Doug has given you what you asked for. :-)

Signature
Stefan Blom
Microsoft Word MVP
> Thanks for your help! Okay, I tried it, but it's omitting the filename from
> all pages in the section except for the 1st page. In your code it looks like
[quoted text clipped - 63 lines]
> > >
> > > CAN YOU HELP? THANKS A LOT
Sammy - 06 Nov 2007 22:10 GMT
One other question if you don't mind, what is the best approach to formatting
the filename field with an 8pt font? I would select and then format after
the field was inserted. Is this the best method? thanks again
> The easiest solution would seem to set up a template for this. But if you
> want to do it in VBA, the following variation on your code works:
[quoted text clipped - 59 lines]
> >
> > CAN YOU HELP? THANKS A LOT
Doug Robbins - Word MVP - 07 Nov 2007 02:33 GMT
Use this corrected, augmented version of Stefan's code:
Dim i As Integer
For i = 1 To 1 'ActiveDocument.Sections.Count
With ActiveDocument.Sections(1)
.Footers(wdHeaderFooterFirstPage).Range.Delete
ActiveDocument.Fields.Add _
Range:=.Footers(wdHeaderFooterFirstPage).Range, _
Type:=wdFieldEmpty, Text:= _
"FILENAME \* Lower ", PreserveFormatting:=True
.Footers(wdHeaderFooterFirstPage).Range.Font.Size = 8
.Footers(wdHeaderFooterPrimary).Range.Delete
ActiveDocument.Fields.Add _
Range:=.Footers(wdHeaderFooterPrimary).Range, _
Type:=wdFieldEmpty, Text:= _
"FILENAME \* Lower ", PreserveFormatting:=True
.Footers(wdHeaderFooterPrimary).PageNumbers.Add _
PageNumberAlignment:=wdAlignPageNumberCenter, firstPage:=False
.Footers(wdHeaderFooterPrimary).Range.Paragraphs(2).Range.Font.Size =
8
End With
Next i

Signature
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
> One other question if you don't mind, what is the best approach to
> formatting
[quoted text clipped - 69 lines]
>> >
>> > CAN YOU HELP? THANKS A LOT
Sammy - 08 Nov 2007 16:33 GMT
THANK YOU DOUG AND STEFAN FOR YOUR HELP!!! WORKS GREAT!
> Use this corrected, augmented version of Stefan's code:
>
[quoted text clipped - 92 lines]
> >> >
> >> > CAN YOU HELP? THANKS A LOT