View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bernie Deitrick Bernie Deitrick is offline
external usenet poster
 
Posts: 5,441
Default Finding attachment point for comment textbox

Josh,

The comment's parent is a range object, which you can find like so:

Sub test()
Dim myComm As Comment
For Each myComm In ActiveSheet.Comments
MsgBox "The comment for cell " & myComm.Parent.Address & _
" has the text:" & Chr(10) & """" & myComm.Text & """"
Next myComm
End Sub

HTH,
Bernie
MS Excel MVP


"Josh Sale" <jsale@tril dot cod wrote in message
...
I'm trying to figure out how to navigate from a textbox that contains a
comment object back to the worksheet cell that the comment is associated
with.

The case begins with the user selecting the comment textbox
(TypeName(Selection) = "TextBox" and Selection.ShapeRange.Type =
msoComment) and then running one of my macro's to manipulate the comment.

The textbox's TopLeftCell and BottomRightCell are relative to where the
textbox got popped up (or was moved by the user) so they don't help.

I just can't figure out how to crossover in the Excel object model from
the textbox that is displaying the comment to the Range.Comment that
actually contains the comment.

Any suggestions?

TIA,

josh