PathFiles




'Funzione che restituisce il solo path, eliminando il nome del file

Public Function SeparaPath(PathCompletoDiFile As String) As String
Dim Dummy As Integer
For Dummy = Len(PathCompletoDiFile) To 1 Step -1
If InStr(":\", Mid$(PathCompletoDiFile, Dummy, 1)) Then Exit For
Next
SeparaPath = Left$(PathCompletoDiFile, Dummy)
End Function

'Funzione che restituisce solo il nome del file, eliminando la parte

'relativa al percorso

Public Function SeparaNomeFile(PathCompletoDiFile As String) As String
Dim Dummy As Integer
For Dummy = Len(PathCompletoDiFile) To 1 Step -1
If InStr("\", Mid$(PathCompletoDiFile, Dummy, 1)) Then Exit For
Next
SeparaNomeFile = Mid$(PathCompletoDiFile, Dummy + 1, Len(PathCompletoDiFile) - I)
End Function

'Funzione che restituisce solo l'estensione del file

Public Function EstensioneFile(NomeFile As String) As String
Dim Dummy As Integer
For Dummy = Len(NomeFile) To 1 Step -1
If InStr(".", Mid$(NomeFile, Dummy, 1)) Then Exit For
Next
EstensioneFile = Right$(NomeFile, Len(NomeFile) - Dummy)
End Function











( pathfiles.html )- by Paolo Puglisi - Modifica del 17/12/2023