VBA and comments in Excel2002

  • Thread starter Thread starter Neil Garrard
  • Start date Start date
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
 
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]
 
[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
 
Thanks JE and Jake.

I guess the question becomes, how do you find about about this? I look up
text object in the various help files of VBA and found no reference to using
..text with comments to return the text. I guess it looks like you have to
try things that would possibly work!!

Cheers,

Neil


JE McGimpsey said:
[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


Neil Garrard said:
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
 
Hmmm...Help in XLv.X brings up the Text method as the 6th item.

You could also check the Comment object in Help and find that is has a
Text method associated with it.

Or you could look at the Comment object in the Object Browser to find
the same thing.
 
Back
Top