hyperjase Posted January 12, 2015 Share Posted January 12, 2015 I'm trying to close Excel totally but using _Excel_Close, by default closes _Excel_Open, but in my case, I haven't used _Excel_Open but rather _ExcelBookOpen (which works perfectly). When I try to use _Excel_Close then referencing the _ExcelOpenBook $variable, I keep getting an error message: "C:\ExcelClose.au3"(3,32) : error: _Excel_Close(): undefined function. _Excel_Close ($Close,False,True) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ And here is the code I have (simple for testing purposes) #include <Excel.au3> $Close = _ExcelBookOpen ("C:\Users\productiondarkroom\Desktop\SteTest Beta 0 R8\01 Red 24V Beta 0 R8.xlsm",1,0) _Excel_Close ($Close,False,True) Link to comment Share on other sites More sharing options...
alienclone Posted January 12, 2015 Share Posted January 12, 2015 (edited) if you are using the latest version of AutoIT with the new and completely re-written excel udf then it should be.. #include <Excel.au3> $Close = _Excel_BookOpen ("C:\Users\productiondarkroom\Desktop\SteTest Beta 0 R8\01 Red 24V Beta 0 R8.xlsm",1,0) _Excel_Close ($Close,False,True) if _ExcelBookOpen() works in your script, but _Excel_Close() does not, then you are trying to use new functions with an old version. Edited January 12, 2015 by alienclone If @error Then MsgBox(262192, "", @ComputerName & " slaps " & @UserName & " around a bit with a large trout!") EndIf "Yeah yeah yeah patience, how long will that take?" -Ed Gruberman REAL search results | SciTE4AutoIt3 Editor Full Version Link to comment Share on other sites More sharing options...
water Posted January 12, 2015 Share Posted January 12, 2015 You always need to use (at least) the following function calls: $oExcel = _Excel_Open() $oWorkbook = _Excel_BookOpen($oExcel, ...) _Excel_BookClose($oWorkbook, ...) _Excel_Close($oExcel) _Excel_Open allows to create a new Excel instance so that you later can close this instance without affecting already running Excel instances. 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...
hyperjase Posted January 12, 2015 Author Share Posted January 12, 2015 Great thank you - looks like I've overlooked some of my code by not using _Excel_BookOpen. Link to comment Share on other sites More sharing options...
hyperjase Posted January 12, 2015 Author Share Posted January 12, 2015 I'm not 100% sure I have the most up-to-date version? This is from the header of the Excel.au3 file AutoIt Version : 3.2.3++, Excel.au3 v 1.5 (07/18/2008 @ 8:25am PST) I do note that the function is still called _ExcelBookOpen in my Excel.au3 file. Where would I get the updated version if this is the case (I checked the link in your signature Water, but couldn't find a download link) Link to comment Share on other sites More sharing options...
water Posted January 12, 2015 Share Posted January 12, 2015 The latest Excel UDF is delivered with AutoIt. Which version of AutoIt do you run? 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...
hyperjase Posted January 12, 2015 Author Share Posted January 12, 2015 I downloaded it from the AutoIt site, whatever is delivered as the latest version; however I've just downloaded the Beta files and replaced the Include folder with that - loading the Excel.au3 file shows the newer version. Hopefully that will solve my issue! Many thanks. Link to comment Share on other sites More sharing options...
water Posted January 12, 2015 Share Posted January 12, 2015 There is no need to replace the Include folder. The Excel UDF that comes with the latest AutoIt production version should work as well. 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...
hyperjase Posted January 12, 2015 Author Share Posted January 12, 2015 I must have installed slightly before the update, I've fully removed everything, downloaded again and re-installed - working fine now with the newer version. Sorry, thought I was losing the plot! Link to comment Share on other sites More sharing options...
water Posted January 12, 2015 Share Posted January 12, 2015 Great. Make sure to read the section about the Script Breaking Changes for Excel. 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