tagName Property

Microsoft FrontPage Visual Basic

tagName Property

Returns a String that represents the name of an element.

expression.tagName

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

Example

The following example sets the background color of the active element if the active element is a P element.

    Dim objElement As IHTMLElement
Dim objPara As FPHTMLParaElement
Dim objStyle As IFPStyleState

Set objElement = ActiveDocument.activeElement

If LCase(objElement.tagName) = LCase("p") Then
    Set objPara = objElement
    Set objStyle = ActiveDocument.createStyleState
    
    objStyle.gatherFromElement objPara
    
    objPara.Style.backgroundColor = "blue"
End If