Sign in to follow this  
Followers 0
AndyS01

ObjCreate("Excel.Application") fails when compiled

21 posts in this topic

I have a test file that creates an Excel.Application object, and it works OK when I run it with F5, but when I compile it and run the executble, the operation fails.
 
Here is my code:
Opt('MustDeclareVars', 1)

Global $oMyError, $oExcel

_Main()
Exit (1)

Func _Main()
    Local $str

    $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") ; Initialize a COM error handler
    If IsObj($oMyError) Then
        $oExcel = ObjCreate("Excel.Application")
        If IsObj($oExcel) Then
            $str = "Created the Excel.Application object OK"
        Else
            $str = "ObjCreate() FAILED!"
        EndIf
    Else
        $str = "ObjEvent() FAILED!"
    EndIf

    MsgBox(0, "results", $str)
EndFunc   ;==>_Main

Func MyErrFunc()
    Local $str
    $str = "We intercepted a COM Error !" & @CRLF & @CRLF & _
            "err.description is: " & @TAB & $oMyError.description & @CRLF & _
            "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _
            "err.number is: " & @TAB & Hex($oMyError.number, 8) & @CRLF & _
            "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _
            "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _
            "err.source is: " & @TAB & $oMyError.source & @CRLF & _
            "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _
            "err.helpcontext is: " & @TAB & $oMyError.helpcontext
    ClipPut($str)
    MsgBox(0, "AutoItCOM Test", $str & @CRLF & "(results are in the clipboard)")
    Exit (1)
EndFunc   ;==>MyErrFunc

Here is the error info:

We intercepted a COM Error !

err.description is:     
err.windescription:    Not enough storage is available to complete this operation.

err.number is:     8007000E
err.lastdllerror is:     0
err.scriptline is:     -1
err.source is:
err.helpfile is:
err.helpcontext is:

Share this post


Link to post
Share on other sites

Do you run the compiled script on the same computer?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Searching the web I found a lot of hits. Most of the time the suggested solution was to reinstall Excel.

Can you please give us more information?

  • Which version of Excel? 32/64 bit?
  • Which operating system? 32/64 bit?
  • Which version of AutoIt?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
I'm runnng this all on the same computer.
Excel: Office 2010 32 bit
O/S: Windows 7 32 bit
AutoIt: 3.3.6.1
SciTE: 3.3.7 (Dec 12 2013 20:45:19)
 

Share this post


Link to post
Share on other sites

Autoit 3.3.6.1 is quite old. Some COM related errors have been removed in 3.3.8.1 or even the latest 3.3.10.2.

Any chance to upgrade?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Great!  That fixed it.

All in all, here's what I did

Completely uninstalled, then re-installed Office 2010

     Still got an error

Completely uninstalled SciTE4Autoit

Downloaded and installed the AutoIt Full Installation (3.3.10.2)

Downloaded and installed SciTE4AutoIT 3.3.7 (Dec 12 2013 20:45:19)

That fixed the problem.

Thank you

Share this post


Link to post
Share on other sites

Glad to be of service :)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Wait!! This issue is still open!!  When I rebooted and rebuilt the .exe file, I still got the 'out of memory' errors when I double clicked on the new .exe file.  (I had to adjust my calls for the new EXCEL.au3 library, but basically, It still failed.)

I tried uninstalling, then re-installing both the older version (3.3.6.1) and the new version (3.3.10.2), but they both failed.  I also tried uninstalling, then re-installing Microsoft office 2010.

Here is my adjusted code:

Opt('MustDeclareVars', 1)
#include <Excel.au3>

Global $oMyError, $oExcel, $str

_Main()
Exit (1)

Func _Main()
    Local $str

    $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") ; Initialize a COM error handler
    
    If IsObj($oMyError) Then
        openExisting("C:\temp\test.xls")
        openNew()
    Else
        msgbox(0,"ERROR", "ObjEvent() FAILED!")
    EndIf
EndFunc   ;==>_Main

Func openExisting($fn)
    If (FileExists($fn)) Then
        $oExcel = _ExcelBookOpen($fn, 0, 1)
        If IsObj($oExcel) Then
            $str = "_ExcelBookOpen(): OK"
            _ExcelBookClose($oExcel)
        Else
            $str = "_ExcelBookOpen(): FAILED!"
        EndIf
    Else
        $str = "File does not exist:" & @CRLF & "   " & $fn
    EndIf

    MsgBox(0, "openExisting() results", $str)

EndFunc   ;==>openExisting

Func openNew()
    $oExcel = ObjCreate("Excel.Application")
    If IsObj($oExcel) Then
        $str = "Created the Excel.Application object OK"
    Else
        $str = "ObjCreate() FAILED!"
    EndIf
    MsgBox(0, "ObjCreate() results", $str)
EndFunc   ;==>openNew

Func MyErrFunc()
    $str = "We intercepted a COM Error !" & @CRLF & @CRLF & _
            "err.description is:  " & @TAB & $oMyError.description & @CRLF & _
            "err.windescription:  " & @TAB & $oMyError.windescription & @CRLF & _
            "err.number is:       " & @TAB & Hex($oMyError.number, 8) & @CRLF & _
            "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _
            "err.scriptline is:   " & @TAB & $oMyError.scriptline & @CRLF & _
            "err.source is:       " & @TAB & $oMyError.source & @CRLF & _
            "err.helpfile is:     " & @TAB & $oMyError.helpfile & @CRLF & _
            "err.helpcontext is:  " & @TAB & $oMyError.helpcontext
    MsgBox(0, "AutoItCOM Test", $str)
EndFunc   ;==>MyErrFunc

Share this post


Link to post
Share on other sites

Any chance to compile the script on your computer and run it on another?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Ran it on another win7 laptop - same problem

Share this post


Link to post
Share on other sites

We do not know the line number when the script is compiled. So can you please insert a MsgBox before any call to an _Excel* function or ObjCreate.?

We need to know where the error occurres.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Do you store the exe in a "trusted location"?

I have a similar strange problem with my AD UDF when I run a complied exe from an untrusted location.

Where do you store the Exe?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

I run it in my local directory (C:UtilAutoIT-srcmyStuffIOT_Util).  This was all working a while ago.  I've re-installed Microsoft Office 2010 recently and I'm wondering if there's a COM object conflict here.

Today, I bit the bullet and trashed my hard drive and re-installed Windows 7 and all of my supporting software, including AutoIT, SciTE4AutoIT, Microsoft Offinc 2010, etc., and I am back to getting the "out of memory" errror.

Share this post


Link to post
Share on other sites

Which settings do you use to compile your script? Do you use obfuscator, UPX etc.?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

I use whatever the default is for compiling using F7.  I have no other directives in my code.

Here is the command: 

 

>"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /prod /in "C:UtilAutoIT-srcmyStuffIOT_Utiltest1.au3"

+>17:12:25 Starting AutoIt3Wrapper v.2.1.4.4 SciTE v.3.3.7.0 ;  Keyboard:00000409  OS:WIN_7/Service Pack 1  CPU:X64 OS:X86    Environment(Language:0409  Keyboard:00000409  OS:WIN_7/Service Pack 1  CPU:X64 OS:X86)
>Running AU3Check (3.3.10.2)  from:C:Program FilesAutoIt3
+>17:12:26 AU3Check ended.rc:0
>Running:(3.3.10.2):C:\Program Files\AutoIt3\Aut2Exe\aut2exe.exe  /in "C:UtilAutoIT-srcmyStuffIOT_Utiltest1.au3" /out "C:UsersAndyAppDataLocalAutoIt v3Aut2exe~AU3ktfouvq.exe" /nopack /comp 2
+>17:12:27 Aut2exe.exe ended.C:UsersAndyAppDataLocalAutoIt v3Aut2exe~AU3ktfouvq.exe. rc:0
+>17:12:27 Created program:C:UtilAutoIT-srcmyStuffIOT_Utiltest1.exe
+>17:12:27 AutoIt3Wrapper Finished..
>Exit code: 0    Time: 2.567
 

Share this post


Link to post
Share on other sites

Then I have run out of ideas :ermm:


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Anyone else?  I'm really stuck here.

Share this post


Link to post
Share on other sites

I just went back to previous versions of the .exe that was getting the errors and all of them displayed the error.  These all ran successfully at the time they were archived.

Share this post


Link to post
Share on other sites

So either Windows or Office causes the problem.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0

  • Similar Content

    • GarnetDagger
      By GarnetDagger
      I would love to have some help or guidance 
      I am able to Query from my database but I am not able to Update or insert etc because I lack the knowledge for it
       
      this is my code for to retrieve some data from and works perfect
       
      Dim $ueberschriften = "" Dim $anzahl = 0 Dim $dsncount = 1 Global $DSN = "MTXXV5" Global $Query = "Select * from VIEWS" Func SSSQL($SSQuery) ;SuperSonicSQL     ConsoleWrite($SSQuery & @LF)     $cmboVal = ""     $adoCon = ObjCreate("ADODB.Connection")     $adoCon.Open($DSN)     $adoRs = ObjCreate("ADODB.Recordset")     $adoSQL = $SSQuery     $adoRs.CursorType = 2     $adoRs.LockType = 3     $adoRs.Open($adoSQL, $adoCon)     With $adoRs         Global $QueryAnswer = .GetRows     EndWith     Return $QueryAnswer EndFunc   ;==>SSSQL and this is my failed attempt, The Query is correct but I want to able to use it in autoit instead of have to manual update or insert into flamerobin
       
      $SS_SQL_Insert_or_Update = "INSERT INTO DETECTION (DNAME,DTYPE,WINNAME,AREA,COLOR,MOUSE) VALUES ('PopUpTradeInviteYes        s                    ','SEARCH','XXX','175,240,550,240,65,228,82,234','5062478','0') " Func SSSQLIU($SS_SQL_Insert_or_Update) ;SuperSonicSQL :P     $cmboVal = ""     $adoCon = ObjCreate("ADODB.Connection")     $adoCon.Open($DSN)     $adoRs = ObjCreate("ADODB.Record")     $adoSQL =$SS_SQL_Insert_or_Update ;~     $adoRs.CursorType = 2     $adoRs.LockType = 4     $adoRs.Open($adoSQL, $adoCon) ;~     With $adoRs ;~         Global $QueryAnswer = .GetRows ;~     EndWith ;~     Return $QueryAnswer EndFunc   ;==>SSSQL I am at a total loss and I am just trying this at random but I am also going to sleep now
      I would love to have some minor examples
      "C:\_CC_V10_DetectionTAB.au3" (174) : ==> The requested action with this object has failed.:
      $adoRs.Open($adoSQL, $adoCon)
      $adoRs^ ERROR
    • RichardL
      By RichardL
      Local $sAxName Local $oMSComm $sAxName = "MSCOMMLib.MSComm.1" $oMSComm = ObjCreate($sAxName) MsgBox(0, Default, StringFormat("Name: %s, Obj %d, Err %d", $sAxName, IsObj($oMSComm), @error)) I'm talking to serial ports (for Arduino) using the MSComm object.  It all runs fine from SciTE or .exe.  If I compile to .a3x the object is not created.  I could manage without .a3x but I like it because it compiles faster.
       
       
    • BobRoss
      By BobRoss
      Hi All,
      Now before I start, I have trawled through the forum & elsewhere for the last 24 hours or so & found nothing to even point me in the right direction.
      I have a rather large script that's doing various (AD reads & applying RegWrites based on the SID & AD reads....) & I've stripped it all back & the problem appears to lie with the create object which is calling a sproc I wrote to pull back various based on params passed.
      Now for the actual issue, all worked fine first time everywhere apart from within a Citrix xenapp session which is when I'm getting hit with the Exception Occured Script Line -1 - Variable must be of type 'Object'.
      Here is a stripped back portion which I've been testing with against xenapp (with a MsgBox added to easily see if anything did return), can anyone notice anything glaringly stupid that I'm doing?
      Global $AppError = ObjEvent("AutoIt.Error","ErrFunc") $Emp=@UserName $adDSN="Driver={SQL Server};Server=*****;Database=*****;Uid=****;Pwd=*****" $adCN = ObjCreate ("ADODB.Connection") $adCN.Open ($adDSN) $FNsQuery = "exec [ooo_sp_ad_user] @user="&$Emp&",@type=1" $FNresult = $adCN.Execute($FNsQuery) $ADFirstName=$FNresult.Fields("").Value MsgBox(0, "AD Test", $ADFirstName) $adCN.Close Func ErrFunc() Local $HexNumber Local $strMsg $HexNumber = Hex($AppError.Number, 8) $strMsg = "Error Number: " & $HexNumber & @CRLF $strMsg &= "WinDescription: " & $AppError.WinDescription & @CRLF $strMsg &= "Script Line: " & $AppError.ScriptLine & @CRLF MsgBox(0, "ERROR", $strMsg) SetError(1) Endfunc Any pointers at all would be greatly appreciated.
      Thanks
      Bob
    • kokoilie
      By kokoilie
      I'm using irrlight to display 3D models in a window but I can't create any controls in this window
      and I thought I could compile the code and use objcreate () to display the irrlight (3D) part and overlay it with the autoit gui controls

      if it won't work is there a way to add gui controls on to the window created by the .dll?
    • afzalw
      By afzalw
      I have used the following code to open and close an excel file after working in it, but after the file is closed I checked the task manager it shows EXCEL.EXE * 32 in the process tab. Is there a way to remove this from task manager also when I close my excel workbook ?

      Thanks


      ; Open the already existing Excel File #include <Excel.au3> $oExcel = ObjCreate("Excel.Application") Local $sFilePath1 = @ScriptDir & "\Excel File.xlsm" ;This file should already exist Local $oExcel = _ExcelBookOpen($sFilePath1) ;Opening the file $oExcel.application.quit ;Closing the Excel Application