Hi Ajit,
I have created 450 files approx. in two months without inserting any footer.
What filenames? What location?
Is there any kind of system in the file names or the folders?
Can you access all files programmatically,
e.g. by aplication.filesearch ?
Without opening each file and inserting footer separately is a tedious work.
How can I put a footer to each file with full path & file name at one go?
Not at all,
but Word can do all in the background, if the documents
are rather simple and equally structured.
If the are small, too, if your machine is fast
and above all the storage device, than Word would need
hardly more than let's say 2 - 4 second for each file.
I fact, I need here on a local drive for
10 small and simple document 1,5 seconds.
Example:
Sub Test()
Dim t As Single
Dim l As Long
Dim oDcm As Document
Dim rTmp As Range
t = Timer
Application.Visible = False
With Application.FileSearch
.NewSearch
.LookIn = "c:\testy\"
.FileName = "*.doc"
.Execute
For l = 1 To .FoundFiles.Count
Set oDcm = Documents.Open(.FoundFiles(l))
Set rTmp = oDcm.Sections(1).Footers(wdHeaderFooterPrimary).Range
rTmp.InsertAfter oDcm.FullName
oDcm.Save
oDcm.Close
Next
End With
Application.Visible = True
MsgBox Timer - t
End Sub
You might use a field instead of oDcm.FullName,
but that wasn't the questions.
Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98
http://word.mvps.org/