Reizvoller

Unknown Function _Excel_ReadRange

6 posts in this topic

Hello!

I am just starting to play around with AutoIt and excel sheets to help automate some job duties. To begin learning I figured the ability to read from an excel sheet and apply those values to variables would be handy. I wrote the following script to reference the attached excel sheet. 

 

#include <Excel.au3>
#include <MsgBoxConstants.au3>



Box ()

Func Box ()
Global $sA1 = _Excel_RangeRead ( test.xlsx , Sheet1 , A1, 1 )
MsgBox ($IDOK, "Excel Return", $sA1 )

Sleep (10000)

EndFunc

I would have gone further but I get an error returned of "Unknown Function Name" pointed at the "_Excel_RangeRead" line. I made sure that I included the Excel.au3 then actually explored said file to ensure that the function "_Excel_RangeRead" was in it ( which it was ).

I am running SciTE-Lite Version 3.5.4 that I obtained via installing the main AutoIt package that included the full suite of AutoIt tools on a Windows 10 machine trying to manipulate a Microsoft Office 2010 Excel sheet.

 

Any advice regarding this little dilemma would be vastly appreciated. Thank you for your time! 

test.xlsx

Share this post


Link to post
Share on other sites



You are either running an old version of AutoIt which includes the old Excel UDF (all functions are named _Excel* - note the missing second underscore).
Or there is a another Excel UDF in your script directory or the user include directory.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Howdy,

Currently on version v3.3.14.2 for Autoit which ( please do correct me! ) is the latest version. It was a fresh install ( haven't ever used it before ) so I am fairly sure that it should have installed "Properly" without any conflicts.

Could you please elaborate a little more on the differences between old and new Excel UDF?

I am not sure what you mean regarding the underscores and I would like to be sure I am seeing what I should.

As for additional UDFs , I haven't downloaded additional packages for AutoIt or installed any additional items for it. I am still running "Stock Install". With that being said, is it still possible I have additional UDFs? 

Thank you for your help!

Share this post


Link to post
Share on other sites

Details about the different versions of the Excel UDF can be found here: https://www.autoitscript.com/autoit3/docs/script_breaking_changes_excel_udf.htm

I do not think the _Excel function can not be found but the first parameter is interpreted as a function as it isn't a string:

test.xlsx

should be

"test.xlsx"

 

Please check the example scripts in the help file! You'll notice that _Excel_Open and _Excel_BookOpn are missing and that parameter 1 of _Excel_RangeRead should be the workbook object as returned by _ExcelBookOpen.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

You are fantastic.

I definitely got ahead of myself and messed up in my own scripting. I copy/pasted an example to then run it and it ran appropriately. I am going to walk away from my desk for a few and then look at it with fresh eyes. Thank you very much for helping me through my silly error. 

Have a great day!

Share this post


Link to post
Share on other sites

Glad to be of service :)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
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