评论对象的祖先
我想使用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
但它给了我错误,因为
我正在 Word VBA 中尝试未设置对象变量(错误 91)
I wanted to find the ancestor of a specified comment object using VBA and have written the code.
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
But it is giving me the error as Object variable not set (Error 91)
I am trying in Word VBA
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须检查
oComment.Ancestor 是什么都没有
,因为Ancestor
是一个对象You have to check for
oComment.Ancestor is nothing
asAncestor
is an object