From: Harish Sharma on
Fumei2,

I found that this macro is running correctly in another document. Only in
one particular document it is giving this error. I am not sure why it is so.
I checked the page size and margin but they are normal

Left margin =0.5 inch
Right margin =0.5 inch
width=8.5 inch
Height=11 inch

thanks

"Fumei2 via OfficeKB.com" wrote:

> Bottom line:
>
> "I am not sure why it is showing such huge value for R margin and left
> margins."
>
> It is because Margins are in POINTS.
>
> On my computer:
>
> ActiveDocument.PageSetup.RightMargin = 90
>
> PointsToCentimeters(ActiveDocument.PageSetup.RightMargin) = 3.175
> PointsToInches(ActiveDocument.PageSetup.RightMargin) = 1.25
>
>
>
> Harish Sharma wrote:
> >I am not sure what is wrong with the below code:
> >
> >'I am expecting to get value for left margin and right margin and then use
> >those values to get the page area. However I am not getting correct left and
> >right margin value.
> >
> >the message box shows " R Margin: 9999999 Left Margin: 9999999 Page width:
> >612"
> >
> >I am not sure why it is showing such huge value for R margin and left margins.
> >
> >Private Sub PageArea()
> >
> >Dim PArea, RMargin, LMargin As Double
> >
> >RMargin = ActiveDocument.PageSetup.RightMargin
> >LMargin = ActiveDocument.PageSetup.LeftMargin
> >PArea = ActiveDocument.PageSetup.PageWidth-(LMargin +RMargin)
> >
> >MsgBox "R margin: " & RMargin & " Left Margin: " & LMargin & " Page Width: "
> >& PArea
> >
> >End Sub
> >
> >Thanks,
>
> --
> Message posted via http://www.officekb.com
>
> .
>