| :: Returns the filename from a path |
Author |
David Costelloe |
Language |
VB5, VB6 |
Operating
Systems |
Windows 95, 98 and NT |
| Module |
Function GetFileName(fname As String) As String
Dim i As Long
On Error Resume Next
For i = Len(fname) To 1 Step -1
If Mid(fname, i, 1) = "\" Then
Exit For
End If
Next i
GetFileName = Trim(Mid(fname, i + 1))
End Function |
| Usage |
'Usage:
Private Sub Command1_Click()
' Good for
removing the path
MsgBox GetFileName("C:\Windows\System\moricons.dll")
End Sub |
|
 |
|
 |