Public Function FileNameOnly(strPathName As String) As String
' Purpose: Convert a string from a fully qualified path to a file name.
' In: strPathName - The fully qualified path
' Out: None
' Date: 8/13/1999
' Programmer: Ian Lent
' Last Modified:
Dim lngIndex As Long ' Backslash character positon
Dim strRemnant As Variant ' What remains after trimming off
' everything to the left
' of the last backslash character.
strRemnant = strPathName
Do
lngIndex = InStr(strRemnant, "\")
If lngIndex = 0 Then Exit Do ' There are no more backslash characters: we have the name.
strRemnant = Right$(strRemnant, Len(strRemnant) - lngIndex)
Loop
FileNameOnly = strRemnant ' Sock it to me!
End Function