Jump to content

Fails to copy excel cell sometimes


Recommended Posts

15 hours ago, water said:

You do not find this error codes in the help file because they are not AutoIt or SciTE related. This are pure Windows error codes.

  • Start Windows calculator
  • Switch to programmer mode
  • copy the decimal error code (e.g. -2147352570) to the calculator and retrieve the hex representation
  • Google for "HRESULT 0x80020006" to get the error description

I copied your script, modified the workbook name, selected a cell in Excel and then used Ctrl+1 to retrieve the value of the selected cell.

Which cell did you select (e.g. "A1) and which value do you expect? is it a plain value or a formula in the cell?

I made a unlisted youtube video showing exactly what I did.

 

Link to comment
Share on other sites

@tonn333
Before the MsgBox that displays the value of the active cell, add this line of code:

If @error Then Exit MsgBox("_Excel_RangeRead ERR: " & @error)

because some error occurred (and the return value of 0 confirms this theory), that something went wrong :)

Edited by FrancescoDiMuro

Click here to see my signature:

Spoiler

ALWAYS GOOD TO READ:

 

Link to comment
Share on other sites

21 minutes ago, FrancescoDiMuro said:

@tonn333
Before the MsgBox that displays the value of the active cell, add this line of code:

If @error Then Exit MsgBox("_Excel_RangeRead ERR: " & @error)

because some error occurred (and the return value of 0 confirms this theory), that something went wrong :)

Thank you. 

I added this:

If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Error", "_Excel_RangeRead ERR: " & @error & ", @extended = " & @extended)

This is the error message I got:

image.png.6568daea26b7b0962efab067459f0521.png

Help file says:

@error: 3 - $vRange is invalid. @extended is set to the COM error code

-2147352567 in hex is 80020009

Googling "HRESULT 80020009" gave me nothing I can understand.

How should I proceed?

Link to comment
Share on other sites

Which version of Excel do you run?

Can you please replace all "Local" variable definitions in the main script with "Global" and try again?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Can you please add the following line after _Excel_Open:

If @error Then Exit MsgBox("_Excel_Open ERR: " & @error)

 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

17 minutes ago, water said:

Can you please add the following line after _Excel_Open:

If @error Then Exit MsgBox("_Excel_Open ERR: " & @error)

 

Excel version 1906 (Build 11727.20244)

Did all that. Heres a video to show what happened.

As you can see, I copied your code but for some odd reason it showed a bunch of errors but when I copied from existing code it did not show the same errors.

Still doesn't work.

Link to comment
Share on other sites

26 minutes ago, tonn333 said:

Excel version 1906 (Build 11727.20244)

You seem to use Office 365 ProPlus.

Do you run the cloud version or on premise?
I'm still on Office 2016 so know near to nothing about Office 365 ;)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Sure.
There must be some bug somewhere.
Can you please replace function _DoWork?

Func _Dowork()
    ; $sActiveCell = _Excel_RangeRead($oWorkbook, Default, $oExcel.ActiveCell)
    Local $sActiveCell = $oExcel.ActiveCell.Value
    MsgBox($MB_SYSTEMMODAL, "Info", "Value of active cell: " & $sActiveCell)
EndFunc   ;==>_Dowork

 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...