Bug 106278 - Worksheet Comment Parent is Nothing, expecting a Range object of associated cell
Summary: Worksheet Comment Parent is Nothing, expecting a Range object of associated cell
Status: RESOLVED INSUFFICIENTDATA
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
5.2.5.1 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: needsDevAdvice
Depends on:
Blocks: Calc-Comments Macro-VBA
  Show dependency treegraph
 
Reported: 2017-03-02 10:50 UTC by Aaron J. Peterson
Modified: 2022-07-15 03:45 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
spreadsheet showing bug (10.30 KB, application/vnd.oasis.opendocument.spreadsheet)
2021-12-15 03:11 UTC, Leslie
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Aaron J. Peterson 2017-03-02 10:50:44 UTC
Description:
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 5.2.5.1 and 5.3.0.3

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)

Actual Results:  
"Nothing"

Expected Results:
"Range"


Reproducible: Always

User Profile Reset: No

Additional Info:
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
Comment 1 Xisco Faulí 2017-03-02 11:00:49 UTC
Hello Aaron,

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.)
Comment 2 Aaron J. Peterson 2017-03-02 11:39:26 UTC
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:


Sub DelComments()
    Dim cm As Comment
    Dim ws As Worksheet
    
    For Each ws In Worksheets
        ws.Activate
        For Each cm In ActiveSheet.Comments
            cm.Delete
            cm.Parent.AddComment Text:="Comment is deleted."
        Next cm
    Next ws
End Sub


(from https://www.mrexcel.com/forum/excel-questions/539902-visual-basic-applications-parent-comment.html)

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.
'91'
Object variable not set.

I'll make up a file with that script and a spreadsheet with a comment if you think need it.
Comment 3 Buovjaga 2017-03-04 18:49:38 UTC
Eike: what do you think?
Comment 4 Ryens 2020-09-26 06:45:07 UTC Comment hidden (spam)
Comment 5 Raquelrooks 2020-11-07 21:22:06 UTC Comment hidden (spam)
Comment 6 Xisco Faulí 2021-11-23 11:15:29 UTC
Hello Aaron,
Could you please try to reproduce it with the latest version of LibreOffice from https://www.libreoffice.org/download/libreoffice-fresh/ ?
I have set the bug's status to 'NEEDINFO'. Please change it back to 'UNCONFIRMED' if the bug is still present in the latest version.
Comment 7 Leslie 2021-12-15 03:11:18 UTC
Created attachment 176932 [details]
spreadsheet showing bug
Comment 8 Leslie 2021-12-15 03:12:42 UTC
I can confirm this bug with this version 

Version: 7.2.3.2 (x64) / LibreOffice Community
Build ID: d166454616c1632304285822f9c83ce2e660fd92
CPU threads: 4; OS: Windows 6.1 Service Pack 1 Build 7601; UI render: Skia/Raster; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: threaded
Comment 9 QA Administrators 2022-06-14 03:28:29 UTC Comment hidden (obsolete)
Comment 10 QA Administrators 2022-07-15 03:45:17 UTC
Dear Aaron J. Peterson,

Please read this message in its entirety before proceeding.

Your bug report is being closed as INSUFFICIENTDATA due to inactivity and
a lack of information which is needed in order to accurately
reproduce and confirm the problem. We encourage you to retest
your bug against the latest release. If the issue is still
present in the latest stable release, we need the following
information (please ignore any that you've already provided):

a) Provide details of your system including your operating
   system and the latest version of LibreOffice that you have
   confirmed the bug to be present

b) Provide easy to reproduce steps – the simpler the better

c) Provide any test case(s) which will help us confirm the problem

d) Provide screenshots of the problem if you think it might help

e) Read all comments and provide any requested information

Once all of this is done, please set the bug back to UNCONFIRMED
and we will attempt to reproduce the issue. Please do not:

a) respond via email 

b) update the version field in the bug or any of the other details
   on the top section of our bug tracker

Warm Regards,
QA Team

MassPing-NeedInfo-FollowUp