用Dir得到文件名(包含扩展名)
再检测"."的位置,用Left函数取"."前的字符
Public Function gstrGetFileName(ByVal strTemp As String)
Dim intTemp As Integer
intTemp=Instr(strTemp,".")
gstrGetFileName=Left(strTemp,intTemp-1)
End Function调用gstrGetFileName("D:\clc\clc\map\hb0101110.tab")
再检测"."的位置,用Left函数取"."前的字符
Public Function gstrGetFileName(ByVal strTemp As String)
Dim intTemp As Integer
intTemp=Instr(strTemp,".")
gstrGetFileName=Left(strTemp,intTemp-1)
End Function调用gstrGetFileName("D:\clc\clc\map\hb0101110.tab")
Dim pos1 As Long, pos2 As Long
pos1 = InStrRev(str, "\")
pos2 = InStrRev(str, ".")
GetFileName = Mid$(str, pos1 + 1, pos2 - pos1 - 1)
End Function
sFilePathName = Right(sFilePathName, Len(sFilePathName) - InStr(sFilePathName, "\"))
Filename = ""
Filename = sFilePathName
Loop
End Function
包你可以!