What I really want to do is to set top, bottom, right and left margins for a
specific page.
/BosseH
Hi Bo,
Margins are *section* properties. In order to set margins for one page
that are different from those on the preceding and following pages,
that page must be made into a separate section by putting section
breaks before and after it.
This example macro will do that. Because of the Next Page section
breaks and the change in margins, what was on one page may turn out to
be more or less than one page, so it might not be quite what you
wanted.
Sub OnePageSection()
Dim oRg As Range, oRgWork As Range
' get the range of the current page
Set oRg = ActiveDocument.Bookmarks("\page").Range
' set the working range to start of page
Set oRgWork = oRg.Duplicate
oRgWork.Collapse wdCollapseStart
'insert section break
oRgWork.InsertBreak Type:=wdSectionBreakNextPage
' set the working range to end of page
Set oRgWork = oRg.Duplicate
oRgWork.Collapse wdCollapseEnd
'insert section break
oRgWork.InsertBreak Type:=wdSectionBreakNextPage
' contract oRg slightly to avoid including break
oRg.MoveStart wdCharacter, 2
' modify margins -- change as you want
With oRg.Sections(1).PageSetup
.TopMargin = InchesToPoints(2)
.BottomMargin = InchesToPoints(2.5)
.LeftMargin = InchesToPoints(0.5)
.RightMargin = InchesToPoints(0.5)
End With
End Sub
--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.