Overwriting the content of all footers, despite section breaks (xpost mic.pub.word)

K

K J

I think I posted in a low-traffic group, so I'm going to cross-post
here, now that I've found the "traffic ratings" in Google Groups.
Thanks for your patience with this!


--PART 1--
I have to edit 4 similar-but-different documents at work so their
footers will all have "1/07" instead of "1/06" in the footer. "Easy,"
I thought, "I'll just replace the even page text & the odd page text
and I'll be done." Then I found out that because of section breaks in
the document, the "even page" & "odd page" footers start over every few
pages...and this is a 300-page document or something (times 4
documents).

Okay, that's not so bad...get into a footer, do a search & replace, and
I THINK that should be taken care of. (I haven't done it yet but soon
will try.)

Here's my big problem: the footers are divided into 3 columns of a
table. One on the left has that "Blah blah, (1/07)" text left-aligned.
A second in the middle has centered text that's just the page number.
And a third on the right has right-aligned text that says, "Blah blah
blah blah blah," but I need to add to it so it says, "New Extra Stuff
Blah blah blah blah blah." That doesn't fit on one line, though,
unless I mess with the width of the right column. And, of course, I
have to mess with the width of the left column, too, to make sure that
the left and right boundaries of the middle column stay centered around
the center of the page so that the centered text within it will be
centered on the page.

All this dragging--or perhaps a little faster, shortcut-keying through
editing 3 columns' worth of "column width," is REALLY annoying done
some hundred or so times per document, because each time I do it, the
change only repeats for a couple of pages.

Is there any way to either overwrite ALL footers with the same thing,
even spanning section breaks (because actually, the evens & odds in
this document are the same--it's just the headers that vary by
even/odd)?

OR

Is there any way to link all footers to previous, even spanning section
breaks, in a single action? (It is equally annoying to click "link to
previous" and hit enter through the messages some hundred or so times
per document.)

Thank you!


--PART 2--
Oh, and by the way, I tried making & running this macro and it changed
nothing in the later footers--no "1/06" to "1/07," no table column
widths...nothing.

Maybe they're all "linked" now, but my eyes tell me they sure ain't the
same yet.

(It does seem that page 2, which used to be blank, now has page 1's
content, but that after a section break, everything went back to same
old, same old--in other words, the "same as-ing" didn't SPAN section
breaks.)

Sub TurnOnFooterSameAsPrevious()
'
' link Macro
Dim sSection As Section
Dim fFooter As HeaderFooter
' Go to each section in the document.
For Each sSection In ActiveDocument.Sections
' Turns off "Same As Previous" in all Footers.
For Each fFooter In sSection.Footers
fFooter.LinkToPrevious = True
Next
Next sSection
End Sub


--PART 3--
Okay, this effort completely failed, too. It ran an infinite loop, and
when I hit "break" on my keyboard (which worked right away,
fortunately), nothing was different about column widths far down the
document.

I guess that means it got stuck somewhere in an early section.

Sub ChangeCellWidthsInAllSections()
Dim sSection As Section
Dim fFooter As HeaderFooter
' Go to each section in the document.
For Each sSection In ActiveDocument.Sections
' Changes the column widths in all footers.
For Each fFooter In sSection.Footers
Selection.Tables(1).Columns(1).Width =
InchesToPoints(2.94)
Selection.Tables(1).Columns(2).Width =
InchesToPoints(0.48)
Selection.Tables(1).Columns(3).Width =
InchesToPoints(3.24)
Next
Next sSection
End Sub
 
S

Suzanne S. Barnhill

I can answer at least part of your question. Yes, you can have all the
footers linked even though the headers are not. But note that each footer is
linked only to the corresponding previous one (Even to Even, Odd to Odd).
It's actually possible that the headers can be linked as well. If they
contain variable text that reflects text in the document, it's likely that
you can use a StyleRef field to achieve this.
 
K

K J

Thank you...it's nice to confirm that theoretically they CAN be linked
across sections...but I still haven't found a way to automate actually
making them do it. :-\
 
S

Stefan Blom

Footers (as well as headers) are linked to previous, by default, in
newly created sections.

For existing sections, you would have to manually click the Same As
Previous/Link to Previous buttons (the name is different in different
versions of Word) on the Header and Footer toolbar for each type of
footer (and/or header).

To speed up the process in your long document, a macro could be
helpful:

1. Cut the contents from the footer you want to keep; you can
temporarily paste it into the current or another document.

2. Run the following macro to "connect" footers:

Sub LinkFooters()
Dim s As Section
For Each s In ActiveDocument.Sections
s.Footers(wdHeaderFooterEvenPages).LinkToPrevious = True
s.Footers(wdHeaderFooterFirstPage).LinkToPrevious = True
s.Footers(wdHeaderFooterPrimary).LinkToPrevious = True
Next s
End Sub

3. Paste the contents that you cut in step 1 into the first, even, and
odd footer of any section.

--
Stefan Blom
Microsoft Word MVP


in message
news:[email protected]...
 

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