ParsePAth




Option Explicit

Private Enum ParseWhat
pwDrive = 0
pwPath = 1
pwFileName = 2
pwExtention = 3
End Enum

Private Function ParsePath(Path As String, _
WhatToParse As ParseWhat) As String
Select Case WhatToParse
Case pwDrive
ParsePath = Mid(Path, 1, InStr(1, Path, "\"))
Case pwPath
ParsePath = Mid(Path, 1, InStrRev(Path, "\") - 1)
Case pwFileName
ParsePath = Mid(Path, InStrRev(Path, "\") + 1)
Case pwExtention
ParsePath = Mid(Path, InStrRev(Path, ".") + 1)
End Select
End Function











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