Opened 16 years ago
Closed 16 years ago
#1546 closed Bug (Works For Me)
Creating new excel book is not working.
| Reported by: | bnashwath | Owned by: | |
|---|---|---|---|
| Milestone: | Component: | AutoIt | |
| Version: | 3.3.4.0 | Severity: | None |
| Keywords: | Cc: |
Description
I have include Excel.au3 header file in my code. I am trying to open new excel sheet. but i am getting error in header file line number 153. As soon as compiler executes _ExcelBookNew()from header file Excel.au3. its stops at line no 153 saying error. I am gettin following error :
C:\Program Files\AutoIt3\Include\Excel.au3 (153) : ==> The requested action with this object has failed.:
.ActiveWorkbook.Sheets(1).Select ()
.ActiveWorkbook.Sheets(1).Select () ERROR
Exit code: 1 Time: 1.855
Below is the code which opens excel sheet saves with specific name.
; Script Start - Add your code below here
;Include file for excel sheet operation
#Include <Excel.au3>
;To open new excel sheet
$oExcel = _ExcelBookNew() ;[$fVisible = 1]
;check for errors
If @error =1 Then
MsgBox(0, "Status", "Unable to create the Excel COM object", 3)
EndIf
;Save the File as 'Baselinetestreport.xls"
_ExcelBookSaveAs($oExcel, @ScriptDir & "\baselinetest\BaselinetestReport", "xls", 0, 1)
;Check for errors
If Not @error Then
MsgBox(0, "Success", "File was Saved!", 3)
EndIf
;This method will save then Close the file, without any of the normal prompts, regardless of changes
_ExcelBookClose($oExcel, 1, 0)
Attachments (0)
Change History (2)
comment:1 by , 16 years ago
comment:2 by , 16 years ago
| Resolution: | → Works For Me |
|---|---|
| Status: | new → closed |
under Win7, office 2007 with dir you can write in, it is working for me even with the old release 3.3.4.0

Although the example with _ExcelBookNew() works for me, it sounds like it might need to undergo the same mod described in this thread: http://www.autoitscript.com/forum/index.php?showtopic=105197