Databases Reference
In-Depth Information
Set FileSpec = FSO.GetFile(FileWithPath$)
FileSize = FileSpec.Size
'We are done here
Exit Function
'Error Handling
File_Unavailable:
FileSize = 0
End Function
Function FileType(ByVal FileWithPath$) As String
Dim FSO As FileSystemObject
Dim FileSpec As File
On Error GoTo File_Unavailable
Set FSO = New FileSystemObject
Set FileSpec = FSO.GetFile(FileWithPath$)
FileType = FileSpec.Type
'We are done here
Exit Function
'Error Handling
File_Unavailable:
FileType = "Unknown"
End Function
Function FileLastModified(ByVal FileWithPath$) As String
'Returns the Date-Time File Last Modified like this "02/22/1999
8:29:42 PM"
Dim FSO As FileSystemObject
Dim FileSpec As File
On Error GoTo File_Unavailable
Set FSO = New FileSystemObject
Set FileSpec = FSO.GetFile(FileWithPath$)
FileLastModified = FileSpec.DateLastModified
'We are done here
Exit Function
'Error Handling
File_Unavailable:
FileLastModified = "Unknown"
End Function
The three functions just presented are derivatives of the earlier functions and fairly self explan-
atory in nature. Notice that unlike the functions that operated on a drive , these functions that operate
on a file must include the full path to the file to be examined. They also utilize the file object as
opposed to the drive object. A function that returns the attributes of a particular file is a bit more
complicated.
Function FileAttrib(ByVal FileWithPath$) As String
Search WWH ::




Custom Search