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
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