Be the first user to complete this post

  • 0
Add to List

FileSystemObject : GetExtensionName Method

Description:

Returns extension of a file, return empty string if file doesn’t exist.

Format : 

objectOfFileSystemObject. GetExtensionName(filepath)

  • objectOfFileSystemObject : As the names says, it’s a FileSystemObject.
Arguments: 
  • filepath
    • Mandatory
    • Type:     String
    • filepath , whose extension to be return.
Function FnGetExtensionName (strFilePath)
      Set fso = CreateObject("Scripting.FileSystemObject")
      strFileExtension = fso. GetExtensionName (strFilePath)     
      FnGetExtensionName = strFileExtension
End Function

Msgbox FnGetExtensionName ("c:\NewFolder\file.txt")



Also Read:

  1. Excel-VBA : Insert Multiple Images from a Folder to Excel Cells
  2. FileSystemObject : MoveFolder Method
  3. FileSystemObject : GetParentFolderName Method
  4. FileSystemObject : GetAbsolutePathName Method
  5. FileSystemObject in Excel Macro
  6. FileSystemObject : GetDriveName Method
  7. VBA-Excel: Add/Insert multiple objects from a folder in an Excel Document.
  8. FileSystemObject:OpenTextFile Method