DownloadTime Property

Microsoft FrontPage Visual Basic

DownloadTime Property

Returns a Long that represents the simulated amount of time (in seconds) a given file will take to download. Read-only.

expression.DownloadTime

expression    Required. An expression that returns a WebFile object.

Remarks

This property is used in conjunction with the ConnectionSpeed property to determine which files will appear in the Slow Pages report.

Example

The following example displays the names of all files in the current Web site with a download time greater than a specified value. The subroutine prompts the user to enter a download time in seconds. It then searches through each file in the All collection and displays the names of any file with a download time greater than the specified number of seconds. The Name property value is added to a String containing the names of all matching files in the collection. The String, stored in the variable strName, is then displayed to the user. If no matching files are found in the Web site, a message is displayed to the user.

    Sub DownloadTime()
'Displays the names of all files with a download time greater than
'a given value

    Dim objApp As FrontPage.Application
    Dim objwebFile As WebFile
    Dim objWebFiels As WebFiles
    Dim strSec As String    'User input value
    Dim strNames As String  'Name of all matching files
    Dim blnFound As Boolean 'Boolean flag

    Set objApp = FrontPage.Application
    Set objWebFiles = objApp.ActiveWeb.AllFiles
    blnFound = False
    'Prompt user to enter input
    strSec = InputBox("Enter the number of seconds download time.")
    'Search through each file in the collection
    For Each objwebFile In objWebFiles
        'If user input is less than download time
        If strSec < objwebFile.DownloadTime Then
            blnFound = True
            If strName = "" Then
                strName = strName & objwebFile.Name
            Else
                'Otherwise add next file name to string
                strName = strName & ", " & vbCr & objwebFile.Name
            End If
        End If
    Next objwebFile

    If blnFound = True Then
       'Display names of all files that match the criteria
       MsgBox "The files that take longer than " & _
              strSec & " seconds to download are: " & vbCr & vbCr & _
              strName & "."
    Else
        'No files, display message
        MsgBox "There are no files that match your criteria."
    End If

End Sub