Run the code below to see a few of the features of using the FileSystemObject on a file path.
I hope this helps you out.Code:Private Sub Command1_Click() Dim oFSO As Object Dim filePath As String Set oFSO = CreateObject("Scripting.FileSystemObject") filePath = "c:\folder1\folder2\textfile.txt" MsgBox "Filename (no extension) = " & oFSO.getbasename(filePath) & vbCrLf & _ "Filename with extension = " & oFSO.getfilename(filePath) & vbCrLf & _ "Extension = " & oFSO.getextensionname(filePath) & vbCrLf & _ "Drive = " & oFSO.getdrivename(filePath) End Sub




Reply With Quote