WordBasic.FilePageSetup to ActiveDocument.PageSetup

  • Thread starter charlie.planetxsolutions
  • Start date
C

charlie.planetxsolutions

hi there,

i was wondering if anyone could help me out? i'm trying to convert the
following wordbasic command:

WordBasic.FilePageSetup Tab:="0", PaperSize:="0", TopMargin:="1" + Chr(34),
BottomMargin:="1" + Chr(34), LeftMargin:="0.5" + Chr(34), RightMargin:="0.5"
+ Chr(34), Gutter:="0" + Chr(34), PageWidth:="8.5" + Chr(34),
PageHeight:="11" + Chr(34), Orientation:=0, FirstPage:=0, OtherPages:=0,
VertAlign:=0, ApplyPropsTo:=4, FacingPages:=0, HeaderDistance:="0.5" +
Chr(34), FooterDistance:="0.5" + Chr(34), SectionStart:=2,
OddAndEvenPages:=0, DifferentFirstPage:=0, Endnotes:=0, LineNum:=0,
StartingNum:="", FromText:="", CountBy:="0", NumMode:=-1

to the proper vba format:
With ActiveDocument.PageSetup
.TopMargin = num
.BottomMargin = num
.LeftMargin = num
.RightMargin = num
.Gutter = num
.PageHeight = num
.PageWidth = num
.Orientation = WdOrientation
.FirstPageTray = WdPaperTray
.OtherPagesTray = WdPaperTray
.VerticalAlignment = WdVerticalAlignment
.SetAsTemplateDefault
.MirrorMargins = True
.HeaderDistance = num
.FooterDistance = num
.SectionStart = WdSectionStart
.OddAndEvenPagesHeaderFooter = True
.DifferentFirstPageHeaderFooter = True
.SuppressEndnotes = True
With LineNumbering
.Active =True
.StartingNumber = num
.DistanceFromText = num
.CountBy = num
.RestartMode = WdNumberingRule
End With
End With

i'm particularily curious the original command is trying to do with the
references to Char(34).

also, is there some way to determine what a wordbasic number constant value
would equate to when using vb constants? for example, what will "2" equal for
system constants WdSectionStart?

thanks again!
 
J

Jay Freedman

In the WordBasic code, the Chr(34) represents a double-quote
character, which means "inches" in dialog measurement entries. All the
measurements in the VBA equivalent take units of points. To make the
conversion, use the InchesToPoints function like this:

.TopMargin = InchesToPoints(1)
.LeftMargin = InchesToPoints(0.5)

For a value of 0 you don't need any conversion.

The best way to find the numeric values of Word constants is to open
the Object Browser -- in the VBA editor, press F2. Enter the constant
name or any reasonably unique part of it in the search box and hit
Enter. If you look up the WdSectionStart enumeration, you'll find that
the value 2 corresponds to wdSectionNewPage.

If you have a lot of this to do, download the WordBasic Help file from
Word 95. It's available on my site at http://jay-freedman.info.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
 

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

Top