marginRight Property

Microsoft FrontPage Visual Basic

marginRight Property

Returns or sets a String that represents the width of the right margin for the specified object. Corresponds to the marginRight property of an inline style attribute.

expression.marginRight

expression    Required. An expression that returns one of the objects in the Applies To list.

Remarks

The String for the marginRight property can be one or more of the following values:

Value Description
auto Right margin measurement is the default setting.

The following code sets the right margin in the active document to the default setting.

ActiveDocument.body.Style.marginRight = "auto"
width Floating-point number, followed by an absolute units designator (cm, mm, in, pt, pc, or px) or a relative units designator (em or ex).

The following code sets the right margin of the active document to 50 pixels.

ActiveDocument.body.Style.marginRight = "50px"
percentage Integer, followed by a %. The value is a percentage of the width of the parent object.

The following code sets the right margin to 10 percent of the width of the browser window.

ActiveDocument.body.Style.marginRight = "10%"

You can also use the margin property to set all margins at the same time. For example, the following code does the same as the example below but uses the margin property.

    ActiveDocument.body.Style.margin = "auto 25px 2px 50px"
  

Example

The following example sets the top, right, bottom, and left margins for the active document.

    With ActiveDocument.body.Style
    .MarginTop = "auto"
    .MarginRight = "25px"
    .MarginBottom = "1%"
    .MarginLeft = "50px"
End With