ncssCode Property

Microsoft FrontPage Visual Basic

ncssCode Property

Returns or sets a Boolean that determines if a text range will appear as code. The CODE element is used to denote code in an HTML document.

expression.ncssCode

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

Example

The following example encloses the first instance of bold text within a CODE element. The text will now appear as code.

    Sub SetCodeWrap()
 
    Dim objSs As IFPStyleState
    Dim objLine1 As IHTMLElement
    Dim strHTML As String
    
    strHTML = "This is sample text. <br> <b>This is bold and will appear as code.</b>"
    
    Application.ActiveDocument.body.innerHTML = strHTML
    
    Set objLine1 = Application.ActiveDocument.all.tags("B").Item(0)
            
    Set objSs = Application.ActiveDocument.createStyleState
    objSs.gatherFromElement objLine1
    
    objSs.ncssCode = True
    objSs.apply
            
End Sub