Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / March 2005

Tip: Looking for answers? Try searching our database.

Footer Macro

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Nancu - 31 Mar 2005 02:20 GMT
Thanks for looking at this.  I need a macro that will go
into each footer in each section of my document (first
page footers included) and type some text.  Here's my
attempt:

Sub testFooters()
If Documents.Count = 0 Then Exit Sub

Dim i As Integer
For i = 1 To ActiveDocument.Sections.Count

   With ActiveDocument.Sections(i)

    ActiveWindow.ActivePane.View.SeekView =
wdSeekCurrentPageFooter

    Selection.TypeText
Text:="C:\nrport\Admin\AGarber\xx9323_1.doc"

    ActiveWindow.ActivePane.View.SeekView =
wdSeekMainDocument
     
     End With
Next i

End Sub

It simply repeats the text many times in the same footer.  
Can you help me with the code?  Thanks a lot
Jezebel - 31 Mar 2005 03:18 GMT
First, if all you want to do is put the filename into the footer, simpler is
to use a FileName field -- then you have no work to do at all.

However, if you really want to iterate all the footers of a document --

Dim pFooter as Word.Range
Dim pIndex as long
For pIndex = 1 to 3
   Set pFooter = ActiveDocument.StoryRanges(Choose(pIndex, _
                       wdPrimaryFooterStory, _
                       wdFirstPageFooterStory, _
                       wdEvenPagesFooterStory))

   Do until pFooter is nothing
       pFooter.InsertAfter "mytext"  'or whatever you want to do
       set pFooter = pFooter.NextStoryRange
   Loop

Next

> Thanks for looking at this.  I need a macro that will go
> into each footer in each section of my document (first
[quoted text clipped - 25 lines]
> It simply repeats the text many times in the same footer.
> Can you help me with the code?  Thanks a lot

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.