createStyleState Method

       

Returns an IFPStyleState object that represents the properties associated with a given text range.

expression.createStyleState

expression   Required. An expression that returns a DispFPHTMLDocument object.

Example

The following example returns the IFPStyleState object and adds a formatted line of text to the active document.

Sub ChangeStyleState()

    Dim objStyleState As IFPStyleState
    Dim objRange As IHTMLTxtRange

    Application.ActiveDocument.body.innerHTML = _
        "Insert New Document Title Here"

    Set objRange = Application.ActiveDocument.body.createTextRange
    Set objStyleState = Application.ActiveDocument.createStyleState
    objStyleState.gather objRange

    objStyleState.fontWeight = 700
    objStyleState.fontFamily = "arial"
    objStyleState.Apply

End Sub