当前位置:主页 > Office办公 > 原作者

原作者

在excel用VBA更改批注的作者
在excel用VBA更改批注的作者

在Excel中,当光标移动到包含批注的单元格中时,通常会在状态栏和批注中显示批注者的名称。如果需要将批注者改为其他人,可以用下面的VBA代码。以后再插入新的批注,也将使用新输入的名称。使用前先将代码中的“新作者”和“原作者”按照需要进行替换。Sub ChangeCommentName()Dim ws As WorksheetDim cmt As CommentDim strOld As StringDim strNew As StringDim strComment As StringstrNew = "新作者"strOld = "原作者"Application.UserName = strNewFor Each ws In ActiveWorkbook.WorksheetsFor Each cmt In ws.CommentsstrComment = Replace(cmt.Text, strOld, strNew)cmt.Deletecmt.Parent.AddComment Text:=strCommentNext cmtNext wsEnd Sub

303 次浏览