Footers

C

Charles Germann

Word 2000
VB 6
Windows 2000 Pro

I am trying to add footers to my documents. I want different footers
depending on where I am in the document.

For example:

I want NO footer on page 1
On page 2 I want a footer that says "Proprietary Statement"
On page 3 I want something else (say for the next 4 pages)
On page 7 I want something else for the next 3 pages...etc.

The problem is I always get the LAST footer I add in the entire document.

I have tried the "This Point Forward" in the properties of the footers but
it doesn't seem to work. I even tried the "This Section" and I get the same
thing.

Any ideas?

Thanks
 
B

Brian McCullough

Charles,

I had a similar issue not too long ago with Word XP. I believe the
following code worked with Word 97 with only a little tweaking, so it should
work for what you are trying to do...you should be able to find code that
should put you on your way below...

the code below was in a looping structure that had to loop through
thousands of documents, insert a Letter before the main document (different
Header/Footer than the rest of the document), and then insert another 2
documents after the main document (each having their own header and
footer )...


Documents.Open FileName:=sReportDir & sReportFileName,
ConfirmConversions:=False, _
ReadOnly:=False, AddToRecentFiles:=False,
PasswordDocument:="", _
PasswordTemplate:="", Revert:=False,
WritePasswordDocument:="", _
WritePasswordTemplate:="", Format:=wdOpenFormatAuto

'move to the top of the report doc and add a section break
(new page)
Selection.HomeKey Unit:=wdStory
Selection.MoveRight Unit:=wdCharacter, Count:=1,
Extend:=wdExtend
With Selection.Font
.Name = "Arial"
.Size = 11
End With
Selection.InsertBreak Type:=wdSectionBreakNextPage
Selection.HomeKey Unit:=wdStory

'insert the letter
Selection.InsertFile FileName:=sLetterDir & sLetterFileName,
_
Range:="", ConfirmConversions:=False, Link:=False,
Attachment:=False
Selection.HomeKey Unit:=wdStory

'set up the header on the inserted letter
ActiveWindow.ActivePane.View.SeekView =
wdSeekCurrentPageHeader
With Selection.PageSetup
.SectionStart = wdSectionNewPage
.OddAndEvenPagesHeaderFooter = False

'$$$$ line of code
.DifferentFirstPageHeaderFooter = True

.VerticalAlignment = wdAlignVerticalTop
.SuppressEndnotes = False
.MirrorMargins = False
.TwoPagesOnOne = False
.BookFoldPrinting = False
.BookFoldRevPrinting = False
.BookFoldPrintingSheets = 1
.GutterPos = wdGutterPosLeft
End With
Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter

'copy the logo from the Template documents header
'another document was open during the running of my macro
which contained the data i needed
Documents(2).Activate
ActiveWindow.ActivePane.View.SeekView =
wdSeekCurrentPageHeader
Selection.MoveRight Unit:=wdCharacter, Count:=1,
Extend:=wdExtend
Selection.Copy

'paste the logo to the report document
Documents(1).Activate
Selection.PasteAndFormat (wdPasteDefault)

'move to the footer
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
ActiveWindow.ActivePane.View.SeekView =
wdSeekCurrentPageFooter

'copy the footer from the template document
Documents(2).Activate
ActiveWindow.ActivePane.View.SeekView =
wdSeekCurrentPageFooter
Selection.EndKey Unit:=wdStory, Extend:=wdExtend
Selection.Copy

'paste the footer into the current report document and
format
Windows(1).Activate
Selection.PasteAndFormat (wdPasteDefault)
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.HomeKey Unit:=wdStory, Extend:=wdExtend
Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
Selection.EndKey Unit:=wdStory
Selection.TypeBackspace

'unselect the header and footer
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument

'reset the page numbering so the CA Coversheet is page 1

ActiveDocument.Sections(2).Footers.Item(1).PageNumbers.RestartNumberingAtSec
tion = True

ActiveDocument.Sections(2).Footers.Item(1).PageNumbers.StartingNumber = 1

'move to end of document and insert a crlf
Selection.EndKey Unit:=wdStory
Selection.TypeParagraph

'insert the another document
Selection.InsertBreak Type:=wdSectionBreakNextPage
Selection.InsertFile FileName:=sTemplateDir &
"AnotherDoc.doc", Range:="" _
, ConfirmConversions:=False, Link:=False,
Attachment:=False

'reset the header and footer for this "AnotherDoc" section
ActiveWindow.ActivePane.View.SeekView =
wdSeekCurrentPageHeader

'delete the header
ActiveWindow.ActivePane.View.SeekView =
wdSeekCurrentPageHeader
Selection.EndKey Unit:=wdStory, Extend:=wdExtend
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.HeaderFooter.LinkToPrevious = False
'reset the page numbers in the footer
ActiveWindow.ActivePane.View.SeekView =
wdSeekCurrentPageFooter
With Selection.HeaderFooter.PageNumbers
.NumberStyle = wdPageNumberStyleArabic
.HeadingLevelForChapter = 0
.IncludeChapterNumber = False
.ChapterPageSeparator = wdSeparatorHyphen
.RestartNumberingAtSection = True
.StartingNumber = 1
End With
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument


'insert yet another document
Selection.InsertBreak Type:=wdSectionBreakNextPage
Selection.InsertFile FileName:=sTemplateDir &
"YetAnotherDoc.doc", Range:="", _
ConfirmConversions:=False, Link:=False,
Attachment:=False

'reset the header and footer for this "YetAnotherDoc"
section
ActiveWindow.ActivePane.View.SeekView =
wdSeekCurrentPageHeader
Selection.HeaderFooter.LinkToPrevious = False

'reset the page numbers in the footer
ActiveWindow.ActivePane.View.SeekView =
wdSeekCurrentPageFooter
With Selection.HeaderFooter.PageNumbers
.NumberStyle = wdPageNumberStyleArabic
.HeadingLevelForChapter = 0
.IncludeChapterNumber = False
.ChapterPageSeparator = wdSeparatorHyphen
.RestartNumberingAtSection = True
.StartingNumber = 1
End With
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument



Brian
 
M

Mark Tangard

Hi Charles,

Footers are a section property, not a page property. You need to have
3 sections in your document -- that is, place a section break between
pages 2 and 3 and another between pages 6 and 7.

If you knew that already, then the second half of the problem is that
a new section's footer, by default, has the 'Same as Previous' property
set to TRUE. So ordinarily if you create a given section's footer and
then go to the next section and make a new, different footer there, the
second footer replaces the earlier section's footer. (If this seems a
bit counterintuitive to you, you have company.) So you need to turn OFF
'Same as Previous' BEFORE creating subsequent footers.

To do this manually, you would click the Same As Previous button on the
Header/Footer toolbar so that it looks non-pressed. To do this via macro
code, use [FooterObject].LinkToPrevious = False.
 
C

Charles Germann

Thanks Mark

I think this might work!

I appreciate your response.

Mark Tangard said:
Hi Charles,

Footers are a section property, not a page property. You need to have
3 sections in your document -- that is, place a section break between
pages 2 and 3 and another between pages 6 and 7.

If you knew that already, then the second half of the problem is that
a new section's footer, by default, has the 'Same as Previous' property
set to TRUE. So ordinarily if you create a given section's footer and
then go to the next section and make a new, different footer there, the
second footer replaces the earlier section's footer. (If this seems a
bit counterintuitive to you, you have company.) So you need to turn OFF
'Same as Previous' BEFORE creating subsequent footers.

To do this manually, you would click the Same As Previous button on the
Header/Footer toolbar so that it looks non-pressed. To do this via macro
code, use [FooterObject].LinkToPrevious = False.

--
Mark Tangard, Microsoft Word MVP
Note well: MVPs do not work for Microsoft.
"Life is nothing if you're not obsessed." --John Waters



Charles said:
Word 2000
VB 6
Windows 2000 Pro

I am trying to add footers to my documents. I want different footers
depending on where I am in the document.

For example:

I want NO footer on page 1
On page 2 I want a footer that says "Proprietary Statement"
On page 3 I want something else (say for the next 4 pages)
On page 7 I want something else for the next 3 pages...etc.

The problem is I always get the LAST footer I add in the entire document.

I have tried the "This Point Forward" in the properties of the footers but
it doesn't seem to work. I even tried the "This Section" and I get the same
thing.

Any ideas?

Thanks
 

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