ReportSmithing
Programmer
I'm hoping someone can help me out with this problem. I need to extract the file name from a path - I've already been able to strip away up to the file name but I need to strip away the file extension also.
Here's what I have so far...
Dim i As Long
fname = ActiveTitle()
FileExt = Right$(ActiveTitle(), Len(ActiveTitle()) - InStr(ActiveTitle(), "."))
On Error Resume Next
For i = Len(fname) To 1 Step -1
If Mid(fname, i, 1) = "\" Then
Exit For
End If
Next i
GetFileName = Trim(Mid(fname, i + 1))
This works fine, but I still need the file extension removed. Heres the catch: I can't use RevInStr to do this since I'm working on an older application.
Thanks for you help.
Here's what I have so far...
Dim i As Long
fname = ActiveTitle()
FileExt = Right$(ActiveTitle(), Len(ActiveTitle()) - InStr(ActiveTitle(), "."))
On Error Resume Next
For i = Len(fname) To 1 Step -1
If Mid(fname, i, 1) = "\" Then
Exit For
End If
Next i
GetFileName = Trim(Mid(fname, i + 1))
This works fine, but I still need the file extension removed. Heres the catch: I can't use RevInStr to do this since I'm working on an older application.
Thanks for you help.