Siebel VB Language Reference > VB Language Reference >

FileLen Function


This standard VB function returns the length of the specified file.

Syntax

FileLen(pathname)

Argument
Description

pathname

A string or string expression evaluating to the name of the file to query

Returns

The length of the file specified in pathname.

Usage

Pathname can contain path and disk information, but cannot include wildcards (* and ?).

If the specified file is open, FileLen returns the length of the file before it was opened.

Example

This example returns the length of a file.

Sub Button_Click
   Dim length as Long
   Dim userfile as String
   Dim msgtext
   On Error Resume Next
   msgtext = "Enter a filename:"
   userfile = "trace.txt"
   length = FileLen(userfile)
   If Err <> 0 then
      msgtext = "Error occurred. Rerun program."
   Else
      msgtext = "The length of " & userfile & " is: " & length
      End If
End Sub

See Also

FileDateTime Function
GetAttr Function
Lof Function

Siebel VB Language Reference