Property: Drive for File
- Updated2024-09-12
- 1 minute(s) read
FileSystemObject and Dictionary > Properties > Property: Drive for File
Property: Drive for File
Returns the Drive object for a file. You can use this to access the associated drive.
The following example returns the drive of a file:
Function FileDrive(sFile) Dim fso, oMyFile Set fso = CreateObject("Scripting.FileSystemObject") Set oMyFile = fso.GetFile(sFile) FileDrive = "Path: " & oMyFile.Drive End Function