Code:

Private Sub JoinNodes()
Dim s As Shape, sr As ShapeRange
Dim x1#, y1#, x2#, y2#
Set sr = ActiveSelectionRange
If sr.Count <> 2 Then MsgBox "Select 2 shapes!": Exit Sub
If sr(1).Curve.Closed Or sr(2).Curve.Closed Then MsgBox "Shapes must be unclosed!": Exit Sub
sr(1).Curve.Nodes(1).GetPosition x1, y1
sr(2).Curve.Nodes(1).GetPosition x2, y2
Set s = sr(1).Weld(sr(2))
s.Curve.FindNodeAtPoint(x1, y1).ConnectWith s.Curve.FindNodeAtPoint(x2, y2)
s.Curve.Closed = True 'Connect the remaining nodes
End Sub