Length Property

Microsoft FrontPage Visual Basic

Length Property

Returns a Long that represents the number of objects in a specified collection.

expression.Length

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

Example

The following example inserts a MARQUEE element that contains the selected text. It uses the Length property to get the number of MARQUEE elements already in the document.

    Sub InsertMarqueeWithSelectedText()
    Dim objElement As IHTMLElement
    Dim objRange As IHTMLTxtRange
    Dim objMarquee As FPHTMLMarqueeElement
    Dim lngCount As Long
    Dim strID As String

    lngCount = ActiveDocument.all.tags("marquee").Length
    strID = "marquee" & lngCount + 1
    
    Set objRange = ActiveDocument.selection.createRange
    
    objRange.pasteHTML "<marquee id=""" & strID & """>" & _
        objRange.Text & "</marquee>"
End Sub