Private Sub Form_Load()
MsgBox BeutifyPath("c:\windows")
End Sub
Private Function BeutifyPath(sPath As String) As String
Dim sDir As String
sDir = Dir(Left(sPath, InStrRev(sPath, "\")), vbDirectory)
Do While Len(sDir) > 0
If LCase(Right(sPath, Len(sPath) - InStrRev(sPath, "\"))) = LCase(sDir) Then
BeutifyPath = sDir
Exit Do
End If
sDir = Dir
Loop
End Function