VBA and comments in Excel2002

N

Neil Garrard

Hello,

I want to combine comments from two cells and put the combined comment back
into one of the cells.

Writing the comment text back is easy enough with "[range].comment.text",
but how do you read the text from a comment associated with a particular
cell? It appears that the only way to do it is via
"[range].comment.shape.anternativetext". Does anyone have any ideas, sneaky
routines, etc for excel2002?

Thanks in advance,

Neil
 
J

Jake Marx

Hi Neil,

Something like this may work:

Public Function msGetCommentText(rng As Range)
On Error Resume Next
With rng.Comment
msGetCommentText = Replace$(.Text, _
.Author & ":" & vbLf, "")
End With
On Error GoTo 0
End Function

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]
 
J

JE McGimpsey

[range].Comment.Text works for me (XLv.X, XL03 - I don't think anything
changed in XL02).

one way:

With Range("A1").Comment
.Text Text:=.Text & Range("A2").Comment.Text
End With
 
Top