Public Function GetExtension02(sFile As String) As String
' by Donald, donald@xbeat.net, 20001010
Dim iPos As Long
Dim iPosPrev As Long
' search last dot
Do
iPosPrev = iPos
iPos = InStr(iPos + 1, sFile, ".", vbBinaryCompare)
Loop While iPos > 0
If iPosPrev > 0 Then
' must be right of last backslash
If InStr(iPosPrev + 1, sFile, "\", vbBinaryCompare) = 0 Then
GetExtension02 = Mid$(sFile, iPosPrev + 1)
End If
End If
End Function
|