setProperty Method

Microsoft FrontPage Visual Basic

setProperty Method

Sets the value of the specified attribute for an IFPStyleState object.

expression.setProperty(strAttributeName, AttributeValue)

expression    Required. An expression that returns an IFPStyleState object.

strAttributeName    Required String. The name of the style attribute to be modified. You can get a list of style attributes from the CSS Reference on the Microsoft Developer Network (MSDN) Web site.

AttributeValue    Required Variant. The setting for the specified style attribute.

Remarks

Use the apply method to apply the changes to the text range or element.

For color property settings, the AttributeValue parameter can be an integer from 0 (black) to 16777215 (white) or a Microsoft Visual Basic color constant, such as vbBlue. For a list of Visual Basic color constants, see Color Constants on the MSDN Web site.

Example

The following example creates a SPAN element with a style attribute that sets the background color for the element to blue for each element in the active document that contains text.

    Dim objSs As IFPStyleState
Dim objRng As IHTMLTxtRange
    
Set objRng = ActiveDocument.body.createTextRange
Set objSs = ActiveDocument.createStyleState

With objSs
    .gather objRng
    .setProperty "background-color", vbBlue
    .Apply
End With