You may find it easier to use Join to build your string from the array rather than looping.
Sub mOpenFile()
Dim aVar() As String
'split the path into an array
aVar = Split(ThisWorkbook.Path, Application.PathSeparator)
'if the last element of the array is toolbox
If aVar(UBound(aVar)) = "Toolbox" Then
'redim the array to get rid of the last element
'Preserve is used to keep all the rest of the data intact
ReDim Preserve aVar(LBound(aVar) To UBound(aVar) - 1)
End If
'join the elements of the array into a string
Debug.Print Join(aVar, Application.PathSeparator)
End Sub
Update
I turned it into a function to test.
Function mOpenFile(ByVal sPath As String) As String
Dim aVar() As String
'split the path into an array
aVar = Split(sPath, Application.PathSeparator)
'if the last element of the array is toolbox
If aVar(UBound(aVar)) = "Toolbox" Then
'redim the array to get rid of the last element
'Preserve is used to keep all the rest of the data intact
ReDim Preserve aVar(LBound(aVar) To UBound(aVar) - 1)
End If
'join the elements of the array into a string
mOpenFile = Join(aVar, Application.PathSeparator)
End Function