View Single Post
 
Old 01-13-2024, 10:06 AM
RobiNew RobiNew is offline Windows 10 Office 2016
Competent Performer
 
Join Date: Sep 2023
Posts: 208
RobiNew is on a distinguished road
Default

This one works OK, but is there a simpler method? Thanks!
Code:
Sub TestNew()
Dim StrPath As String, t As Long
StrPath = "C:\Sub_1\Sub_2\Sub_3"
If Right(StrPath, 1) = "\" Then StrPath = Left(StrPath, Len(StrPath) - 1)
t = InStrRev(StrPath, "\")
StrPath = Left(StrPath, t - 1)
MsgBox StrPath
End Sub
Reply With Quote