How do i get the first directory from a file path, where de directory is e.g.: x:\16.001\Section\110

By using:

MyFolder = CurDir$

MyPath1 = Left(swModel.GetPathName, InStrRev(swModel.GetPathName, "\") - 1)

MyPath1 = Right(MyPath1, Len(MyPath1) - InStrRev(MyPath1, "\"))

i can get 110.

But i can't get to 16.001

Any help would be welcome

Hi

Using " Split (x:\16.001\Section\110, "\") " will give you an array :

x:

16.001

Section

110

First 2 can be combined in the new string:

Dim vPath As Variant

vPath = Split (x:\16.001\Section\110, "\")

Dim newStr As String

newStr = vPath(0) & "\" & vPath (1)

which will give: x:\16.001 or just vPath (1) (which is 16.001) if necessary

Regards