anubis Posted August 2, 2015 Share Posted August 2, 2015 I am experiencing a error when I try to read a cell comment when a comment does not exist. I have reported this as bug but the moderators have said this is this is a consequence of the recent change in how COM errors are dealt with. Offending code is below along with the message that appears in the console window. I tried installing a COM error handler, but the code does not trigger the handler. Is anybody else experiencing this issue and have you found a solution. The code works perfectly if the cell has a comment.$sStr = $oExcel.Cells($iRow, $iColumn).Comment.Text$sStr = $oExcel.Cells($iRow, $iColumn).Comment^ ERROR Link to comment Share on other sites More sharing options...
water Posted August 2, 2015 Share Posted August 2, 2015 (edited) Welcome to AutoIt and the forum!My suggestion: Use the Excel UDF that comes with AutoIt. It does the COM error handling stuff for you. Remember that _Excel_RangeRead can only read the comment of a single cell (Excel limitation). Edited August 2, 2015 by water My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
anubis Posted August 2, 2015 Author Share Posted August 2, 2015 I figured it out. I adjusted my code to test to see if the Comment object exists before I try to read the text. IsObj($oExcel.Cells($irRow, $iColumn).Comment) does the trick. IsObj reports failure if a comment does not exist.BTW, the Excel UDF does not include functions for Comments so it is not much help in that regard. Link to comment Share on other sites More sharing options...
water Posted August 2, 2015 Share Posted August 2, 2015 Ops, you are correct. That is still in the pipeline. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now