PDA

View Full Version : DIFFERENT FOOTER LAST PAGE OF SECTION



Greg
05-23-2010, 05:55 PM
Hi all,

I keep coming back to my endless struggle to insert (or maintain) a different footer on the last page of section one of my affidavits. Attached hereto is a copy of my document as an indication of the problem.

Put simply, I require a footer on the last page of section one but it has to be different from the preceding pages. And, of course, the document is not a static length and may be anywhere between 2 pages and 20 pages depending on the situation.

I have searched high and low for a simple solution to this problem and I have added some code that I found but it doesn't seem to make any difference. The only way I can achieve my desired outcome is to insert section breaks, make the section two footer different form the first section and then adjust the footer accordingly.

Surely there is an easier way. I hope someone can help.

Greg.

Tinbendr
05-23-2010, 06:22 PM
You really should have added to your original question.

The link for everyone else. (http://www.vbaexpress.com/forum/showthread.php?t=29035&highlight=different+footer)

Greg
05-23-2010, 09:53 PM
Here's a copy saved in Word 2003.

It contains the following code (Not my work of course).

My difficulty, as stated on a previous occassion, is that the different footer only applies to the last page of section one. The other pages of that section are different in that they include a place for signatures.

The annexure sheets to the affifavit are also the same as the last page of section one but I don't think I need to worry about them becuase I can insert a further section break.

It may well be that I need code to create a section break (next page) whre the break is only created on the page prior to the last page of the section, regardless of how many pages the affidavit contains.

This is not my forte and I will need you help.

Sub NoFooterLastPage()
Dim iPages As Integer

iPages = Application.ActiveDocument.BuiltInDocumentProperties(14) - 1
Application.ScreenUpdating = False

With Application.Selection
.GoTo What:=wdGoToPage, Which:=wdGoToAbsolute, Count:=iPages, Name:=""
.PageSetup.SectionStart = wdSectionNewPage
.Bookmarks("\page").Select

Application.ActiveDocument.Range(.End - 1, .End - 1).Select

.InsertBreak Type:=wdSectionBreakContinuous
.EndKey Unit:=wdStory, Extend:=wdMove

With .Sections(1).Footers(wdHeaderFooterPrimary)
.LinkToPrevious = False
.Range.Text = "Different last page"
End With
End With
End Sub

TonyJollans
05-24-2010, 02:28 AM
Having skimmed the other thread, and not gone into the details, it seems like the solution proposed by macropod is the one to use.

In your sample document you have ten sections. Are they significant, or just part of your attempt to get the footers you want?

I have just made a quick change to it which does what you ask. I rather think there is more that could be done, but it's your job - I don't have one.

Greg
05-24-2010, 05:58 PM
Thanks Tony. That kinda works but it doesn't do so happily. for example, when I set the footer to allgn left, I can't then align the Deponent and Witness text to the centre position. Also, when I add a reference bookmark (so that the Userform functions) the bookmark itself is copied to each page. Normally I would simply have a bookmark on the first page and use refences for the follwoing pages.

TonyJollans
05-25-2010, 01:22 AM
Hi Greg,

I don't know what either the starting point, or the ultimate aim of this, is, so it's hard to make suggestions.

I have added the Reference bookmark back in - it doesn't need any cross-references as it only exists in one place now. Alignment shouldn't be a problem - what do you want aligned where, exactly?

macropod
05-25-2010, 03:36 AM
Hi Greg,

The only way I can achieve my desired outcome is to insert section breaks, make the section two footer different form the first section and then adjust the footer accordingly.

Surely there is an easier way. I hope someone can help.
Perhaps you could explain why the solution I provided in the other thread doesn't meet your needs? The implication of the above is to say that it wasn't a viable solution ... yet you never came back with a response indicating any problems with it after I both provided the solution and answered your questions about it.

Greg
06-22-2010, 07:52 PM
Thanks for your help Tony,

The code provided works very well provided there is more than two pages.

If I delete some paragraphs with the intention of reducing the document to slightly more than one page, I end up with some paragraphs on page two followed by a lot of space and then the durat (i.e. the place-holder for final signing) appearing on a third page and not on page two where it belongs.

If I then try to pull out the space between those last paragraphs and the durat, I lose the deponent and witness lines on the first page.

My hope is to have a document that can be either one, two or many pages long, depending on my requirements, without having to manually manipulate the footers.

The code provided nearly achieves that and only fails in the circumstance described above.

I hope there is a simple solution.

Regards,

Greg.

TonyJollans
07-07-2010, 04:45 PM
Hi Greg,

Please accept my apologies for not replying - I have no good excuse :-(

I'm not entirely sure what you're doing, but I suspect the end result that you don't want is because you are deleting Section Breaks in your reduction of the document. Could you post a sample showing the failure?