Macro to edit comments....

S

Steve

Is there an easy means for a macro/vba to edit the contents of
comments within a document, e.g., strip the user name and date from
comments throughout a document. Thank-you.
 
S

Shauna Kelly

Hi Steve

You can change the author and the initials for all comments in a document as
follows:

Sub ChangeAuthorName()

Dim oComment As Comment

For Each oComment In ActiveDocument.Comments
With oComment
.Author = "Bugs Bunny"
.Initial = "BB"
End With
Next oComment

End Sub

There is no way to change the date or time of a comment: it's a read-only
property.

Hope this helps.

Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word
 
S

Steve

Thanks!!!!!!!

Steve

Shauna Kelly said:
Hi Steve

You can change the author and the initials for all comments in a document as
follows:

Sub ChangeAuthorName()

Dim oComment As Comment

For Each oComment In ActiveDocument.Comments
With oComment
.Author = "Bugs Bunny"
.Initial = "BB"
End With
Next oComment

End Sub

There is no way to change the date or time of a comment: it's a read-only
property.

Hope this helps.

Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word
 
J

John Owens

I would like to use VBA code to edit comments in a user form instead of the
usual comment window. I would like to run some VBA code to retreive the text
portion of the comment, then edit it in a user form, then copy the edited
comment back to the original comment.

In case you wonder why I want to do this it is because when I am working
with split windowpanes and open a comment to edit it, after closing the
comment edit window my split pane will also disappear.

I know how to add a comment via VBA code, but I haven't found a way to edit
an already existing comment.
Thanks for your help.
John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top