W
What-A-Tool
DK said:I have a directory listing for all the files in a particular drive.
With excel macros, I have extracted filenames with extension in column
E. like filename.xxx
i need to extract the extensions in Column F. Now, column E does not
have all files with extensions.
Extension should be extracted with a condition of having a dot and 3
letter extension.
Can someone please help me in writing a small code?
Put this together for use in an Access database I worked on a while back -
not claiming its the best way - some of the more knowledgeable people around
here may be able to point out a better method - but its always worked for
me.
Good luck - Sean
Private Function GetExtension(ByVal strPath As String) As String
'Get file extension from file name
Dim intPtLoc As Integer
intPtLoc = InStrRev(strPath, ".")
GetExtension = UCase(Right(strPath, (Len(strPath) - (intPtLoc))))
End Function