backgroundPositionX Property

Microsoft FrontPage Visual Basic

backgroundPositionX Property

Sets or returns a String that represents the horizontal position of the background image.

expression.backgroundPositionX

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

Remarks

The String value of the backgroundPositionX property can be one of the following:

length 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 backgroundPositionX property to 50px, which positions the left edge of the the background image to 50 pixels from the left edge of the page.

ActiveDocument.body.Style.backgroundPositionX = "50px 10px"

percentage Integer, followed by a %. The value is a percentage of the width or height of the object.

For example, the following code sets the left edge of the background image to 10 percent of the width of the page.

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

hAlignment Horizontal alignment value consisting of one of the following:
left Horizontal alignment is to the left.
center Horizontal alignment is centered.
right Horizontal alignment is to the right.

Use the backgroundPositionY property to set the vertical position of the background image. You can use the backgroundPosition property to set the horizontal and vertical position of the background image. The following code shows what the example below would look like if you were using the backgroundPosition property to set the horizontal and vertical positions.

    ActiveDocument.body.Style.backgroundPosition = "center top"
  

Example

The following example sets the position of the background image for the active document. This example assumes you have a background image set for the active document.

    With ActiveDocument.body.Style
    .backgroundPositionX = "center"
    .backgroundPositionY = "top"
End With