Jump to content

Recommended Posts

Posted

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

Posted (edited)

brokendownforyou:

type "excel" in the help search, you'll see it almost immediately ;)

Edited by gcue
Posted

#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?

Posted

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")
Posted

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?

Posted

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.

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
  • Recently Browsing   0 members

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