A simple utility function to use when traversing / parsing a DOM tree.
Public Function getRootNodeOf(node As NotesDOMNode) As NotesDOMNode
Set getRootNodeOf = node
If node.ParentNode.IsNull Then Exit Function
Set getRootNodeOf = getRootNodeOf(node.ParentNode)
End Function
Use it like this:
Dim rootNode As NotesDOMNode
Set rootNode = getRootNodeOf(nodeThatYouWantTheRootOf)