Show Buttons
Share On Facebook
Share On Twitter
Share On Google Plus
Share On Linkdin
Share On Reddit
Contact us
Hide Buttons

FileSystemObject : GetDriveName Method

Description: 

Returns drive name, cor­re­spond­ing to the file name.

Format : 

objectOf­FileSys­te­mOb­ject. GetDriveName(filepath)

  • objectOf­FileSys­te­mOb­ject : As the names says, it’s a FileSystemObject.
Arguments: 
  • filepath
    • Manda­tory
    • Type:     String
    • filepath , whose par­ent drive to be return.

Function FnGetDriveName (strFilePath)
      Set fso = CreateObject("Scripting.FileSystemObject")
      strDriveName = fso. GetAName (strFilePath)      
      FnGetDriveName = strDriveName

End Function

Msg­box FnGet­Drive­Name (“c:\NewFolder\file.txt”)

Out­put : C

 

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: