function GetFileName(byval fullpath as string ) as string dim x as long x =instrrev(fullpath,"\") if x then fullpath=mid(fullpath,x+1) x=instrrev(fullpath,".") if x>1 then fullpath=left(fullpath,x-1) GetFileName=fullpath end function
Dim Filestr As String Filestr = Dir("d:\test\*.dat", vbNormal) Do While Filestr <> "" Debug.Print "d:\test\" & Filestr Filestr = Dir Loop
dim x as long
x =instrrev(fullpath,"\")
if x then fullpath=mid(fullpath,x+1)
x=instrrev(fullpath,".")
if x>1 then fullpath=left(fullpath,x-1)
GetFileName=fullpath
end function
Filestr = Dir("d:\test\*.dat", vbNormal)
Do While Filestr <> ""
Debug.Print "d:\test\" & Filestr
Filestr = Dir
Loop