trantrack Posted October 23, 2013 Share Posted October 23, 2013 Good morning! I'd like to start by saying that I have learned alot from this forum. Thanks for all the posts on so many topics! I am new to Autoit and like it very much. This is my first post of hopefully many in the future. My issue today, I am trying to open an excel document in Autoit but keep getting a UDF error, I think... This is the code: #include <Excel.au3> Local $sFilePath = "book1.xlsx" Local $oExcel = _ExcelBookOpen($sFilePath, 1, True) This is the error I am receiving: C:Program FilesAutoIt3IncludeExcel.au3 (191) : ==> The requested action with this object has failed.: If $sPassword = "" And $sWritePassword = "" Then .WorkBooks.Open($sFilePath, Default, $fReadOnly) If $sPassword = "" And $sWritePassword = "" Then .WorkBooks.Open($sFilePath, Default, $fReadOnly)^ ERROR Excel will launch briefly and then close. The file is present on the system I must be overlooking something, but I am unable to figure out what I need to do to make it work. Thanks for your help!!! Link to comment Share on other sites More sharing options...
BrewManNH Posted October 23, 2013 Share Posted October 23, 2013 The included Excel UDF that comes with AutoIt doesn't handle XLSX documents, you should look at water's rewrite of the UDF as it will work better with XLSX documents. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
l3ill Posted October 23, 2013 Share Posted October 23, 2013 Hi and welcome to the forum! your script may have trouble finding the file. this worked for me: #include <Excel.au3> Local $sFilePath = @ScriptDir & "\" & "book1.xlsx" Local $oExcel = _ExcelBookOpen($sFilePath, 1, True) My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
trantrack Posted October 23, 2013 Author Share Posted October 23, 2013 Thanks for your assistance, billo. Luckly, the script is finding the file in this case. I downloaded the new UDF's for excel and tried to run it with the #include <Excel Rewrite.au3> tag. I updated Autoit to the Beta version (I believe it said it was a requirement). Unfortunatly I am receiving this error now: C:Program FilesAutoit_IncludesExcel Rewrite.au3(168,56) : ERROR: ObjGet() [built-in] called with wrong number of args. $oWorkbook = ObjGet("", $sCLSID_Workbook, $iCount + 1) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:Program FilesAutoit_IncludesExcel Rewrite.au3(249,57) : ERROR: ObjGet() [built-in] called with wrong number of args. $oWorkbook = ObjGet("", $sCLSID_Workbook, $iIndex + 1) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:Program FilesAutoit_IncludesExcel Rewrite.au3(1155,27) : ERROR: _ArrayTranspose(): undefined function. _ArrayTranspose($vResult) ~~~~~~~~~~~~~~~~~~~~~~~~^ It finishes by opening the UDF in SciTE. Any idea what I have done wrong at this point? Link to comment Share on other sites More sharing options...
BrewManNH Posted October 23, 2013 Share Posted October 23, 2013 Are you running the script with the Beta or the release version? You can see in the output panel of Scite which version of AutoIt3 is being executed, if it's not 3.3.9.* you're not running the Beta. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Shrapnel Posted October 23, 2013 Share Posted October 23, 2013 Thanks for your assistance, billo. Luckly, the script is finding the file in this case. I downloaded the new UDF's for excel and tried to run it with the #include <Excel Rewrite.au3> tag. I updated Autoit to the Beta version (I believe it said it was a requirement). Unfortunatly I am receiving this error now: C:Program FilesAutoit_IncludesExcel Rewrite.au3(168,56) : ERROR: ObjGet() [built-in] called with wrong number of args. $oWorkbook = ObjGet("", $sCLSID_Workbook, $iCount + 1) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:Program FilesAutoit_IncludesExcel Rewrite.au3(249,57) : ERROR: ObjGet() [built-in] called with wrong number of args. $oWorkbook = ObjGet("", $sCLSID_Workbook, $iIndex + 1) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:Program FilesAutoit_IncludesExcel Rewrite.au3(1155,27) : ERROR: _ArrayTranspose(): undefined function. _ArrayTranspose($vResult) ~~~~~~~~~~~~~~~~~~~~~~~~^ It finishes by opening the UDF in SciTE. Any idea what I have done wrong at this point? If you are using SciTE and pressing F5 to run it, you made the same mistake I did when i first tried out the Excel Rewrite UDF. Pressing F5 runs the script with Production code. You need to press Alt-F5 to run the script with Beta code Link to comment Share on other sites More sharing options...
l3ill Posted October 23, 2013 Share Posted October 23, 2013 (edited) Just FYI I have been using the latest stable vers: >Running:(3.3.8.1) and that is what I used to test it. I had the same issue as trantrak did and fixed it as mentioned above. Maybe this info helps... Edited October 23, 2013 by billo My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
water Posted October 23, 2013 Share Posted October 23, 2013 You need to install the latest beta version of AutoIt and then run the script from SciTE by pressing Alt-F5 to run the script with the beta version. 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...
Juvigy Posted October 24, 2013 Share Posted October 24, 2013 When u double click the exe file does it open ? Sometimes files are corrupt , pass protected and so on. If id doesnt open with double click - it wont open with the UDF too. Link to comment Share on other sites More sharing options...
water Posted October 24, 2013 Share Posted October 24, 2013 The UDF should be able to handle password protected workbooks. Just pass the passwords as parameters to the open function. 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...
trantrack Posted October 25, 2013 Author Share Posted October 25, 2013 Ah! That's what my mistake was. I wasn't running the scripts in the beta version. I tried as Shrapnel suggested and I am feeling great joy that it worked!!! Thanks for all the help!!! Link to comment Share on other sites More sharing options...
Shrapnel Posted October 25, 2013 Share Posted October 25, 2013 (edited) Glad to be of service, trantrack Water, maybe adding a helpful FYI about pressing alt-F5 to run the script in beta mode would be helpful to the people that do not know about it? (not that it would help people that don't read it ) Edit: and if you added it and people still complain, at least you could say RTFM!! Edited October 25, 2013 by Shrapnel Link to comment Share on other sites More sharing options...
water Posted October 27, 2013 Share Posted October 27, 2013 It's already mentioned on the first page of this thread where you download the UDF. I've changed the font to red and bold for better readability. 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