Help with footers

J

JJaster

I need some help with form footers. I have a document that creates by
pulling in bookmarked text. I need to be able to automatically add a
formfooter to each page of each section. The footer need to stay the
same throughout the section and then change at the new section. I've
tried numerous ways to get this to work, but it always ends up changing
the footer throughout the document or combining the footers whenever I
try to add a new footer (regardless if I turn the 'link to previous'
off or not). Following is a sample of my code. In this sample I tried
to go to the next section before adding the footer, but I have the same
problem as when I view next formfooter
(ActiveWindow.ActivePane.View.NextHeaderFooter). Can someone please
let me know what I'm doing wrong or if there is a better way to do
this? Any help is greatly appreciated! I'm working in Word 97.

Judy

ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
If Selection.HeaderFooter.IsHeader = True Then
ActiveWindow.ActivePane.View.SeekView =
wdSeekCurrentPageFooter
End If

Selection.HeaderFooter.LinkToPrevious = Not Selection.HeaderFooter.
_
LinkToPrevious
Selection.TypeText Text:="DEF"

Selection.GoToNext what:=wdGoToSection
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
Selection.HeaderFooter.LinkToPrevious = Not Selection.HeaderFooter.
_
LinkToPrevious
Selection.TypeText Text:="SPEC"
 
S

Suzanne S. Barnhill

I'm not sure whether it would be applicable for what you're doing, but an
easy way to get header/footer text to change without having to fool with
unlinking sections is to use the StyleRef field (which see in Word's Help).

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://www.mvps.org/word
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
C

Charles Kenyon

First, check out the StyleRef field as suggested. It may even obviate the
need for the section breaks.

Otherwise, what you should be working with is the various ranges in your
sections. Check out the articles on the MVP site on working with ranges.
(Your code reflects the code that Word writes when you record a macro
dealing with headers/footers. This code is unnecessarily difficult to use.
After you've looked at those articles, I would suggest reposting in the
vba.beginners newsgroup.
--

Charles Kenyon

Word New User FAQ & Web Directory:
<URL: http://addbalance.com/word/index.htm>

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide)
<URL: http://addbalance.com/usersguide/index.htm>

See also the MVP FAQ: <URL: http://www.mvps.org/word/> which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 
J

JJaster

Thanks for the suggestions. I was able to achive what I was wanting
using the following code:

With ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary)
..LinkToPrevious = False
..Range.Text = "NEL-CP!(04-00)"
End With

'TOC
With ActiveDocument.Sections(2).Footers(wdHeaderFooterPrimary)
..LinkToPrevious = False
..Range.Text = "NEL-TOC(04-00)"
End With
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top