getProperty Method

Microsoft FrontPage Visual Basic

expression.getProperty(strAttributeName)

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

strAttributeName    Required String. The name of the style attribute whose value is to be returned. You can get a list of style attributes from the CSS Reference on the MSDN Web site.

Example

The following example returns the value associated with a given style property.

Sub GetSSProperties()
    Dim objSS As IFPStyleState
    Dim objDoc As FPHTMLDocument
    Dim objRng As IHTMLTxtRange

    Set objDoc = Application.ActiveDocument
    objDoc.body.innerHTML = "<p>Hello World</p>"

    Set objRng = objdoc.body.createTextRange
    Set objSS = objdoc.createStyleState

    With objSS
        .gather objRng
        .Color = vbRed  '  vbRed = 255
        .backgroundColor = vbBlue  '  vbBlue = 16711680
        .Apply
    End With

    Set objRng = objDoc.body.createTextRange
    Set objSS = objDoc.createStyleState
    objSS.gather objRng
    
    MsgBox "Body background color value is " & objSS _
        .getProperty("background-color") & "." & vbCrLf & _
        "Body text color value is " & objSS.getProperty("color") & "."

    Set objRng = Nothing
    Set objSS = Nothing
    Set objDoc = Nothing
End Sub