注释对象的祖先

Ancestor of a comment object

我想用VBA找到指定评论对象的祖先,已经写了代码

Dim oComment as Comment
Set oComment = ActiveDocument.Comments.Item(1)
If (oComment.Ancestor = Null) Then
MsgBox (ActiveDocument.Comments(1).Contact & " has added a new comment")
Else
MsgBox (ActiveDocument.Comments(1).Contact & " has replied to a comment")
End If

但它给我的错误是未设置对象变量(错误 91)

我正在尝试使用 Word VBA

您必须检查 oComment.Ancestor is nothing,因为 Ancestor 是一个对象