Word Margins in VBA

smdesq
07-28-2001, 08:12 PM
I have a word document filled with bookmarks. The document is a letter with attached envelopes. Sometimes the letter could exceed one page. How do I set margins so that the first page has a left margin of 1.8", the rest of the pages has 1.1" and the envelopeshave their own margins? The reason for this is that the first page is letterhead with sometext down the left side of the page. Thanks for your help

BlueRaja
07-30-2001, 07:36 AM
Hi,

You could try using:

Selection.Information (wdActiveEndPageNumber)

This will tell you the page of the end of the current selection is ... or the cursor is. You could start at the top of the document moving the cursor downwards. Once you reach page 2 select to the end using

Selection.EndKey Unit:=wdStory, Extend:=wdExtend

You could now use this sort of thing...

Selection.ParagraphFormat.FirstLineIndent = CentimetersToPoints(5.25)

to change the margins.

I hope this helps.

BlueRaja
07-31-2001, 04:57 AM
Hi,

This is probably better(simpler) than my previous idea. You can just go to the second page and apply margins from there with this...

Selection.GoTo What:=wdGoToPage, Which:=wdGoToNext, Name:="2"
Selection.EndKey Unit:=wdStory, Extend:=wdExtend
Selection.ParagraphFormat.FirstLineIndent = CentimetersToPoints(5.25)

Good luck.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum