#3102 closed Bug (No Bug)
AutoIt Crashes when reading an empty cell comment
Reported by: | anonymous | Owned by: | |
---|---|---|---|
Milestone: | Component: | AutoIt | |
Version: | 3.3.14.0 | Severity: | None |
Keywords: | Cc: |
Description
AutoIT throws the following error when trying to read an the Excel comment if it is empty
Local $sStr = $oExcel.Cells($i, "I").Comment.Text
Local $sStr = $oExcel.Cells($i, "I").Comment ERROR
If the comment is not empty, the comment text is returned.
I am using version 3.3.14.1 & Excel 2003. The error is not present in the previous release version of AutoIT. The problem may be related to an error already reported, but I could not find anything specific
Attachments (0)
Change History (6)
comment:1 Changed 9 years ago by Jos
- Resolution set to No Bug
- Status changed from new to closed
comment:2 Changed 9 years ago by anonymous
Hey Jos;
I am pretty sure this is a bug and is not related to COM error handling. To replicate simply try to read a cell that does not have a comment using $oExcel.Cells(<Row>, <Column>).Comment.Text (where <Row> & <Column> specifies a specific cell). That throws an unrecoverable error for me and AutoIT crashes. I do not think this is planned behavior. If the cell has a comment; then the comment text is returned and all is good. The behavior I am getting means I have to know whether or not a cell has a comment before I try to read it and that is not always possible
As I mentioned, I use Excel 2003 and I do not know if newer versions are affected. Your comment suggests you did not actually actually try to replicate the problem and I am asking you to give it a go
comment:3 follow-up: ↓ 4 Changed 9 years ago by jchd18
As Jos already told you, this is a consequence of the recent change in how COM errors are dealt with. Read changelog and post in help forum if necessary.
comment:4 in reply to: ↑ 3 Changed 9 years ago by anonymous
Replying to jchd18:
As Jos already told you, this is a consequence of the recent change in how COM errors are dealt with. Read changelog and post in help forum if necessary.
Still looks like a bug. I looked at the change log but did not see anything describing COM error handling changes. Looked at error COM error handling in the help file and installed a COM Error handler as described in the example. The offending code does not trigger the error handler. AutoIT just crashes. The example works and if I modify my code to use an invalid object property (Comments instead of Comment); the error handler is called. The problem seems to me that my code not should trigger an error because it is valid code. The code should return an empty string when a comment is not present in the cell.
comment:5 Changed 9 years ago by anonymous
Okay; I figured out how to handle this issue and I am no longer affected. FYI
comment:6 Changed 9 years ago by guinness
FYI post your solution in the Forum please
Guidelines for posting comments:
- You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
- In-depth discussions should take place on the forum.
For more information see the full version of the ticket guidelines here.
I assume this is part of the changes around the COM error handling in the latest release, but this far from a complete bug report. My advise is to go to our forums and start a discussion there before declaring this a bug. In case it is we will need a proper reproducer script and files.
For now: No BUG
Jos