【问题标题】:Write a Macro to Edit an Individual Comment in Word编写宏以在 Word 中编辑单个注释
【发布时间】:2020-02-06 00:44:51
【问题描述】:

到目前为止,我有一个自定义上下文菜单,当我右键单击允许我在 word 中运行宏的评论时会出现该菜单。

如何编写宏以将评论文本替换为“忽略”一词?

将有许多 cmets,其中一些我希望宏在其上运行,而另一些我不希望,因此我需要它来专门更改我右键单击的评论。

这可能吗?

【问题讨论】:

    标签: vba ms-word


    【解决方案1】:

    好的,我找到了解决方案,所以我发帖以防其他人有同样的问题。

    首先,您需要一个自定义快捷菜单来进行右键单击,您可以在此处了解如何构建它:https://gregmaxey.com/word_tip_pages/customize_shortcut_menu.html

    那么你需要用下面的代码创建一个宏:

    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
    

    现在您可以右键单击评论并通过单击宏来替换其文本:)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-29
      • 2015-12-04
      • 2019-05-02
      • 1970-01-01
      • 1970-01-01
      • 2014-09-26
      相关资源
      最近更新 更多