Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add note to footer of LOADS of Word documents 1

Status
Not open for further replies.

MatthewBell

Technical User
Feb 12, 2003
26
GB
Hi There

A question relating to Word, this one.

I have masses of Word documents in a database and have been given the gripping task of adding a copywrite statement to the bottom of every page of every document. The database is Lotus Notes based so I guess I'll have to detach each file one by one (unless some wiz can tell me how to do this with a program) but I'd like to write code to add the statement (same for every document) after whatever is already in the footer (different in every document).

So to summarise. Finding the end of whatevers already in the footer, adding a return and then the statement to all pages in the open document.

Can anyone help me and save my sanity.

Many thanks

Matt [ponder]
 
Hey Matt,

This may be an answer to part of your question...
Code:
Sub InsertNewTextToFooter()
    Dim rng As Range
    For Each Section In ActiveDocument.Sections
        Set rng = Section.Footers(wdHeaderFooterPrimary).Range
        rng.InsertAfter vbCrLf & " THIS IS WHAT I ADDED"
    Next
    Set rng = Nothing
End Sub
Hope this helps :)

Skip,
Skip@TheOfficeExperts.com
 
Thanks for that Skip

It works and even adds a footer if one doesn't exist which is something I needed but forgot to mention.

Unfortunately I forgot to say it needs to be smallprint though. Fontsize 7. Would you be so kind as to let me know how to do this with the code also.

Something to identify the end of the footer and count back a set number of characters as the selection and then setting the fontsize of that bit i.e. not changing the font size of whatever was already in the footer.

Thanks again and apolgies for pestering again.

Matt [roll1]
 
How many characters? Give me an example.

Here's the code for changing the font size to 7...
Code:
Sub InsertNewTextToFooter()
    Dim rng As Range
    For Each Section In ActiveDocument.Sections
        Set rng = Section.Footers(wdHeaderFooterPrimary).Range
        rng.InsertAfter vbCrLf & " THIS IS WHAT I ADDED"
        LastPara = rng.Paragraphs.Count
        With rng.Paragraphs(LastPara).Range
            .Font.Size = 7
        End With
    Next
    Set rng = Nothing
End Sub


Skip,
Skip@TheOfficeExperts.com
 
Fandabbydoosal Skip

The repetetiveness level of my job has just plummeted.

The code does just whats required of it.

Many Thanks [flip]
 
If you can get all your documents into a single folder, the entire process could be done from there with a procedure that kind of looks like this...
Code:
For every Document in YourFolder
   Open the Document
   Perform InsertNewTextToFooter
   Close/Save the Document
Next

Skip,
Skip@TheOfficeExperts.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top