Nigel,

Nigel wrote:
> Hi Bob,
> I was toying with instr but did not know about the reverse version.
> Do you know if this exists in xl97 - I am developing in xl2002 but
> the final product will run in xl97 and at present I cannot test it?


No, InStrRev was introduced in Excel 2000.

Here's an example using the FileSytemObject:

Public Function gsGetFileName(rsPath As String) As String
Dim fso As Object

On Error GoTo ErrHandler

Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists(rsPath) Then gsGetFileName = _
fso.GetFileName(rsPath)

ExitRoutine:
Set fso = Nothing
Exit Function
ErrHandler:
MsgBox Err.Number & ": " & Err.Description
Resume ExitRoutine
End Function


--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]