|
-
Apr 20th, 2011, 12:39 PM
#1
Thread Starter
New Member
[RESOLVED][Word 2010] Insert text in all footers in a document
I am trying to insert some standard text in all footers in a given document while retaining any existing footer text. My text should get inserted at the end of any existing text, on a new line. Here's my code so far:
Public Sub FooterTest()
Dim oSection As Section
Dim oHF As HeaderFooter
Dim ExistingFooterText As String
For Each oSection In ActiveDocument.Sections
For Each oHF In oSection.Footers
FooterEdit
Next
Next
End Sub
Private Sub FooterEdit()
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
Selection.EndKey Unit:=wdStory
Selection.TypeParagraph
Selection.Text = "This is a footer"
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
End Sub
I can't figure out how to get it to loop through the document. This code simply writes "This is a footer" 8 times in the first footer. My sample document has 3 sections (2 pages each), with separate first page footers in each section and no footers are linked, so theoretically, I should only have 6 different footers in the document. I feel it has something to do with wdSeekCurrentPageFooter, but I can't figure out the logic to get it to work.
Last edited by bflo1127; Apr 22nd, 2011 at 10:06 AM.
Reason: Mark as resolved
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|