简体   繁体   中英

VBA macro word comment

I'm new to VBA macros for word. I need to alter an exciting macro operating on comment in word. I need to add the comment reference to a string. What is call the comment reference is the string inside the square brackets, here SM4:

link to image http://dl.dropbox.com/u/13765664/wordcomment.png

How do i get the comment reference?

I'm fairly clueless re Word coding, but this seems to do what you want:

Dim ocom As Comment
For Each ocom In ActiveDocument.Comments
    With ocom
        MsgBox .Author & vbCrLf & .Initial
        MsgBox .Range.Text
    End With
Next

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM