ncssHyperlink Property

Microsoft FrontPage Visual Basic

ncssHyperlink Property

Returns or sets a String that specifies the URL of the hyperlink. Setting the ncssHyperLink property of a text range turns it into a hyperlink.

expression.ncssHyperlink

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

Example

The following example creates hyperlinks from all text ranges enclosed within CITE elements. The user is prompted for the URL for each citation in the active document.

    Sub SetHyperlInk()
 
    Dim objSs As IFPStyleState
    Dim objLine1 As IHTMLElement
    Dim strHTML As String
    Dim strURL As String
    
    strHTML = "This is sample text. <br> <cite>This is italicized and will appear as a hyperlink.</cite>"
    
    Application.ActiveDocument.body.innerHTML = strHTML
    
    For Each objLine1 In Application.ActiveDocument.all.tags("cite")
        Set objSs = Application.ActiveDocument.createStyleState
        objSs.gatherFromElement objLine1
        strURL = InputBox("Enter a URL for the hyperlink:" & _
            vbCr & objLine1.innerText)
        objSs.ncssHyperlink = Trim(strURL)
        objSs.apply
    Next objLine1

End Sub