View Single Post
 
Old 01-13-2024, 11:30 AM
vivka vivka is offline Windows 7 64bit Office 2016
Expert
 
Join Date: Jul 2023
Posts: 302
vivka is on a distinguished road
Default

Hi, RobiNew! I would use a simplified variant of your code without any Ifs:
Code:
Sub BeforeCounterslash()

Dim StrPath As String
StrPath = "C:\Sub_1\Sub_2\Sub_3"

  StrPath = left(StrPath, InStrRev(StrPath, "\") - 1)
MsgBox StrPath
End Sub
Reply With Quote