Я хотел найти предка указанного объекта комментария с помощью 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 является объектом
да, у меня сработало Спасибо