ranhalt Posted December 21, 2009 Posted December 21, 2009 I'm going through the forums and examples, but can't find anything that just creates a brand new Excel spreadsheet and saves it to a target dir/filename for me to play with later. example, I want the script to create test.xls in the working directory. thanks
gcue Posted December 21, 2009 Posted December 21, 2009 (edited) brokendownforyou: type "excel" in the help search, you'll see it almost immediately Edited December 21, 2009 by gcue
ranhalt Posted December 21, 2009 Author Posted December 21, 2009 #include <Excel.au3> $oExcel = _ExcelBookNew() _ExcelBookSave($oExcel) ;Save File With No Alerts If Not @error Then MsgBox(0, "Success", "File was Saved!", 3) By default, this creates in My Documents as Book1.xls. How do I specify location and name?
ranhalt Posted December 21, 2009 Author Posted December 21, 2009 The instructions for SaveAs weren't clear enough that the second parameter includes the filename, it seems like just the path. #include <Excel.au3> $oExcel = _ExcelBookNew() _ExcelBookSaveAs($oExcel, @DesktopDir & "\Checklist","xls")
ranhalt Posted December 22, 2009 Author Posted December 22, 2009 What about opening an existing spreadsheet? I created a blank xls and try to open it using $excel = _ExcelBookOpen("test.xls") but get the error C:\Program Files\AutoIt3\Include\Excel.au3 (189) : ==> 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 >Exit code: 1 Time: 3.745 What's the cause?
rosaz Posted December 22, 2009 Posted December 22, 2009 I was having some trouble with saving as in Excel too - the closest I could come was saving into a folder on my c: drive: #include <Excel.au3> $oExcel.saveas("c:\testfolder\test.xls") where $oExcel is the workbook object.
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