Here are some examples of how to use the InStrRev function:
Code:
Public Sub FilenameAndPath()
Dim FullFileName As String
FullFileName = ThisDrawing.FullName
Dim Path As String
Dim FileName As String
'Find the first backslash from the right of the string.
'This can be used to seperate the filename from subsequent folders.
Dim slashLocation As Integer
slashLocation = InStrRev(FullFileName, "\", -1, vbTextCompare)
Path = Left(FullFileName, slashLocation)
FileName = Mid(FullFileName, slashLocation + 1, _
Len(FullFileName) - slashLocation)
'display the values in the immediate window.
Debug.Print "Path: " & Path
Debug.Print "FileName: " & FileName
End Sub