Comment objects do not have a Parent property defined. It should be a Range object of the comment's associated cell. Without that, it is very difficult to do useful work. For instance iterating over ActiveSheet.Comments becomes useless, as you can't where the comments are or what cell contents each relates to. Same behavior on 126.96.36.199 and 188.8.131.52
Steps to Reproduce:
1. have a worksheet with one or more comments.
2. get a comment object - eg: comment = ActiveSheet.Comments(1)
3. MsgBox typeName(comment.Parent)
User Profile Reset: No
Further example: ActiveSheet.Comments(1).Parent.Parent.Name should return the name of the current Sheet. Looks like Range.Parent isn't wired up either. I must be doing this wrong.
"Function CommentFrom(r As Range)" is trivial but "Sub ExtractAllCommentsToTheRight()" is impossible.
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36
Thank you for reporting the bug. Please attach a sample document, as this makes it easier for us to verify the bug.
I have set the bug's status to 'NEEDINFO'. Please change it back to 'UNCONFIRMED' once the requested document is provided.
(Please note that the attachment will be public, remove any sensitive information before attaching it.
See https://wiki.documentfoundation.org/QA/FAQ#How_can_I_eliminate_confidential_data_from_a_sample_document.3F for help on how to do so.)
It's not a bug with a document or my setup. There simply isn't a Parent property on comment objects, and there should be one. Are you looking for examples of why this should be? There are a ton of uses - http://dmcritchie.mvps.org/excel/ccomment.htm has a boatload. Here's a simple one:
Dim cm As Comment
Dim ws As Worksheet
For Each ws In Worksheets
For Each cm In ActiveSheet.Comments
cm.Parent.AddComment Text:="Comment is deleted."
This fails because cm.Parent, which should be the parent cell Range object, is Nothing. You'll get this error on that line:
BASIC runtime error.
Object variable not set.
I'll make up a file with that script and a spreadsheet with a comment if you think need it.
Eike: what do you think?