Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/solr/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vba 编写宏以编辑Word中的单个注释_Vba_Ms Word - Fatal编程技术网

Vba 编写宏以编辑Word中的单个注释

Vba 编写宏以编辑Word中的单个注释,vba,ms-word,Vba,Ms Word,到目前为止,我有一个自定义上下文菜单,当我右键单击一条注释时,它会出现,允许我在word中运行宏 如何编写宏以将注释文本替换为“忽略”一词 将会有很多评论,有些我希望宏可以运行,有些我不会,所以我需要它来专门更改我右键单击的评论 这可能吗 好的,我已经找到了解决方案,所以我会发布帖子,以防其他人也有同样的问题 首先,右键单击需要一个自定义快捷菜单,您可以在此处找到如何构建此快捷菜单: 然后需要使用以下代码创建宏: Sub ARIgnoreComment0001() If Selection.In

到目前为止,我有一个自定义上下文菜单,当我右键单击一条注释时,它会出现,允许我在word中运行宏

如何编写宏以将注释文本替换为“忽略”一词

将会有很多评论,有些我希望宏可以运行,有些我不会,所以我需要它来专门更改我右键单击的评论


这可能吗

好的,我已经找到了解决方案,所以我会发布帖子,以防其他人也有同样的问题

首先,右键单击需要一个自定义快捷菜单,您可以在此处找到如何构建此快捷菜单:

然后需要使用以下代码创建宏:

Sub ARIgnoreComment0001()
If Selection.Information(wdInCommentPane) = True Then
    Dim Comment
    For Each Comment In ActiveDocument.Comments
        If Comment.Range.Start <= Selection.Start And Comment.Range.End >= Selection.Range.End Then
            Comment.Range.Text = "Ignore this comment!!!"
            End If
        Next
    End If
End Sub
Sub-arignorecommment0001()
如果Selection.Information(wdInCommentPane)=True,则
冷淡的评论
对于ActiveDocument.Comments中的每个注释
如果Comment.Range.Start=Selection.Range.End,则
Comment.Range.Text=“忽略此注释!!!”
如果结束
下一个
如果结束
端接头
现在,您可以右键单击注释并用单击宏替换其文本:)