File Object (VB6)

Description

The File object represents a disk file that can be a file of any type and allows you to interrogate the properties of the file and to move upward in the file system hierarchy to interrogate the system on which the file resides. The process of creating a File object—for example, assigning a reference from the Files object's Item property to a local object variable—doesn't open the file.

The File object is part of the File System object model; for an overview of the model, including the library reference needed to access it, see the File System object model entry.

Createable

No

Returned by

Files.Item property

Properties

Attributes

Data Type: FileAttribute constant

See the "FileAttribute Constants" table in the Folder Object entry.

DateCreated

Data Type: Date

The date the file was created.

DateLastAccessed

Data Type: Date

If available from the operating system, the date the file was last accessed.

DateLastModified

Data Type: Date

The date the file was last modified.

Drive

Data Type: Drive object

Returns a Drive object representing the drive on which the file resides.

Name

Data Type: String

The name of the file.

ParentFolder

Data Type: Folder object

Returns a Folder object representing the folder in which the file resides.

Path

Data Type: String

Returns the full path to the file from the current machine, including drive letter or network path/share name.

ShortName

Data Type: String

Returns a DOS 8.3 filename; may not work on an NTFS system.

ShortPath ...

Get VB & VBA in a Nutshell: The Language now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.