Page Setup This point Forward

K

Kerri

Hi,

I am in Word 2003 trying to create a VBA macro that will create an envelope
(but not the built in envelope) at the last page. The problem I am having,
is telling it to apply the page setup to "THIS POINT FORWARD"...just like
you would do in the page setup box. Or use the section number. Problem
with that is I don't know how to tell it to find out the section number in
order to use it.

Thank you in advance. Your help would be greatly appreciated.
Kerri

Sub Envelopes2()

Dim i As Section
'Go to end of document and insert a next page section break
Selection.EndKey Unit:=wdStory
Selection.InsertBreak Type:=wdSectionBreakNextPage

'Trying to figure out what section I am in inorder to use it in
PageSetup.?????
Set i = Selection.Sections.Last

'Formatting for envevlope settings.
With ActiveDocument.Sections(i).PageSetup
.DifferentFirstPageHeaderFooter = False
.Orientation = wdOrientLandscape
.PaperSize = wdPaperEnvelope10
.TopMargin = InchesToPoints(2#)
.BottomMargin = InchesToPoints(0.5)
.RightMargin = InchesToPoints(0.5)
.LeftMargin = InchesToPoints(3#)
End With
 
D

Doug Robbins - Word MVP - DELETE UPPERCASE CHARACT

ActiveDocument.Sections.Count will give you the section number of the last
section in the document.

--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.
Hope this helps
Doug Robbins - Word MVP
 

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

Similar Threads


Top