by Iratxe Bajo Urcelay (3 Submissions)
Category: String Manipulation
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Wed 20th November 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)
How to extract a file name from one path.
API Declarations
Dim i As Integer
commonDialog1.ShowOpen
nameFile = Mid$(commonDialog1.FileName, 4) 'removes "C:\"
Do
If InStr(1, nameFile, "\") Then 'verifies if there is any "\"
'Yes. It does exist "\"
i = InStr(1, nameFile, "\")
nameFile = Mid$(nameFile, i + 1)
End If
Loop Until InStr(1, nameFile, "\") = False