codice:
Public Function fileName(ByVal FullName As String, Optional extension As Boolean = True) As String
' --------------------------------------------------------------'
' Ritorna il Nome "puro" (default = COMPRESO di ESTENSIONE) '
' del File passato, eliminando il percorso (path) '
' --------------------------------------------------------------'
Dim hStr As String
hStr = ""
If InStr(1, FullName, "\") = 0 Then
fileName = FullName
Else
Do While Left(hStr, 1) <> "\"
hStr = Right(FullName, Len(hStr) + 1)
Loop
fileName = Right(hStr, Len(hStr) - 1)
End If
If Not extension Then
Dim p As Integer
p = Len(fileName)
Do While Mid(fileName, p, 1) <> "." And p > 0
p = p - 1
Loop
If p > 0 Then fileName = Mid(fileName, 1, p - 1)
End If
End Function