M
michaellm
Hi all,
I have a function that works well in Excel 2003.
This function is to get file name from a file path
Like: GetFileName("C:\folder1\name1.txt"
it returns: "name1.txt"
Function GetFileName(fullpath As String)
Dim strFInd As String
Do Until Left(strFInd, 1) = "\"
icount = icount + 1
strFInd = Right(fullpath, icount)
If icount = Len(fullpath) Then Exit Do
Loop
GetFileName = Right(strFInd, Len(strFInd) - 1)
End Function
But it does not work in Excel 2002, maybe because it does not support
Left and Right function in Excel 2002?
How to use this function in Excel 2002 then?
Thanks!
michael
I have a function that works well in Excel 2003.
This function is to get file name from a file path
Like: GetFileName("C:\folder1\name1.txt"
it returns: "name1.txt"
Function GetFileName(fullpath As String)
Dim strFInd As String
Do Until Left(strFInd, 1) = "\"
icount = icount + 1
strFInd = Right(fullpath, icount)
If icount = Len(fullpath) Then Exit Do
Loop
GetFileName = Right(strFInd, Len(strFInd) - 1)
End Function
But it does not work in Excel 2002, maybe because it does not support
Left and Right function in Excel 2002?
How to use this function in Excel 2002 then?
Thanks!
michael