Using " Split (x:\16.001\Section\110, "\") " will give you an array :
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
Thank you for your responce, it worked...
and with FilePath = swModel.GetPathName i even got is to work dynamicaly.
Wonder if i can get 16.001 from the file path if it varies in location or has a added decription.
I guess that in this situation additional conditions could be used. After the path is divided by "Split":
Check that the string is numeric:
Dim numericCheck As Boolean: numericCheck = IsNumeric(testVar)
Check if it contains any special characters:
If inStrRev ("16.001", ".") > 0 Then
Replace in the whole path some part (which you know) by empty characters:
stringResult = Replace ("x:\something\something\16.001-ProjectName\Section\110", "x:\something\something\", "")
Anyway there always be quite a big chance of an error