709-218-7927

The Landfall Garden House

60 Canon Bayley Road

Bonavista, Newfoundland

CANADA A0C 1B0

CPRGreaves@gmail.com

Home

Christopher Greaves

Signature At Foot of Page

Saturday, May 28, 2011

The documents bear a signature on page 2 of a 4-page document, and we wanted to maximize the amount of white space before the signature, by pushing the signature to the foot of the signature page.

Place the cursor in the signature (2nd-last paragraph of page 2) and run the macro SpaceBefore.

Sub SpaceBefore()

' Increase paragraph-spacing-before the first Paragraph of the selection to fill up the current page of the document

Dim prg As Paragraph

Set prg = Selection.Paragraphs(1)

Dim lngSpaceAbove As Long

lngSpaceAbove = prg.SpaceBefore

Dim lngPages As Long

lngPages = prg.Parent.Range.Information(wdActiveEndPageNumber)

While lngPages = prg.Parent.Range.Information(wdActiveEndPageNumber)

lngSpaceAbove = lngSpaceAbove + 1

prg.SpaceBefore = lngSpaceAbove

Wend

prg.SpaceBefore = lngSpaceAbove - 1

End Sub

Minutes later I decided to add some text to the document, pushing the signature paragraph over to page 3, so ...

Place the cursor in the signature (2nd-last paragraph of page 2) and run the macro DecreaseSpaceBefore.

Sub DecreaseSpaceBefore()

' Decrease paragraph-spacing-before the first Paragraph of the selection to pull the current page up by one page.

' Use this after inserting extra text after running "IncreaseSpaceBefore"

Dim prg As Paragraph

Set prg = Selection.Paragraphs(1)

Dim lngSpaceAbove As Long

lngSpaceAbove = prg.SpaceBefore

Dim lngPages As Long

lngPages = prg.Parent.Range.Information(wdActiveEndPageNumber)

While lngPages = prg.Parent.Range.Information(wdActiveEndPageNumber)

lngSpaceAbove = lngSpaceAbove - 1

prg.SpaceBefore = lngSpaceAbove

Wend

End Sub

709-218-7927 CPRGreaves@gmail.com

Bonavista, Sunday, December 08, 2024 9:33 AM

Copyright © 1990-2024 Chris Greaves. All Rights Reserved.