oTestNode = NewNode.Parent.Child DO WHILE oTestNode.Text < NewNode.Text .AND. !ISNULL(oTestNode.FirstSibling) oTestNode = oTestNode.FirstSibling ENDDO NewNode.FirstSibling = oTestNode.FirstSibling oTestNode.FirstSibling = NewNodeThis presupposes that you've already added the node. It might be simpler to identify the slot *before* adding the node otherwise you'll need to add code to the above to exclude the new node itself from the loop.