Edit Word Document Comments using VBA

J

John Owens

I would like to be able to open a userform to edit the comments at the cursor
positon (Selection) of my document. I know I can run through all of the
Item(x) in the ActiveDocument.Item(x).Range.Text to get All the documents
from my document one by one. But I would like to be able the find out which
(Item number) is directly at my Selection point.

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.

Thanks for your help.
John
 
J

John Owens

ActiveDocument.Comments.Item(x).Range.Text Sorry forgot the ".Comments" in
my first post.
 
M

Malcolm Smith

I would like to be able to open a userform to edit the comments at the
cursor positon (Selection) of my document.

I've written something like this in the past. I may need to find the
code and update it a little. How urgent is this?

Perhaps I ought to finally collate a series of tools for the Office Worker
and sell the wretched things one day!

- Malc
www.dragondrop.com
 
J

John Owens

Hi Malcolm,
Well I needed it yesterday and today and ... Well, it you could take the
time to send me the code it would, of course, be very appreciated.

Take care,
John
 
M

Malcolm Smith

Trouble is that a lot of it is wrapped in sensitive code so I just can't
ship the .dot file.

I will try to get to it this weekend if I have time.

- Malc
 
J

John Owens

"No worries" are you from NZ or Aussy Land?

Thanks for your emails.
I got the answer now:
Dim cmt As Word.Comment
For Each cmt In ActiveDocument.Comments
If Selection.Range.InRange(cmt.Scope) Then
MsgBox (ActiveDocument.Comments.Item(cmt.Index).Range.Text)
End If
Next cmt

I just need to edit the info in
ActiveDocument.Comments.Item(cmt.Index).Range.Text
Thanks again.
 

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