使用VB6如何只获取文件名?
代码。
Dim posn As Integer, i As Integer
Dim fName As String
posn = 0
For i = 1 To Len(flname)
If (Mid(flname, i, 1) = "\") Then posn = i
Next i
fName = Right(flname, Len(flname) - posn)
posn = InStr(fName, ".")
If posn <> 0 Then
fName = Left(fName, posn - 1)
End If
GetFileName = fName
FileName: Clockings8.mis06042009 120442.fin
但它显示的文件名是“Clockings8”。它应该显示“Clockings8.mis06042009 120442”
如何修改代码?
需要VB6代码帮助
还有[GetFileName](https://msdn.microsoft.com/en-us/library/office/gg264499.aspx),其中包括扩展名(以保存其他人像我一样搜索,谁需要VB6相当于'Path.FileName') – dlatikay 2017-02-27 13:18:27