Jump to content

com error with excel


Recommended Posts

i guys , i have some problem with this script

#cs ----------------------------------------------------------------------------

    AutoIt Version: 3.3.12.0
    Author:         faustf

    Script Function:
    GROSSISTI GRABBER
    BY faustf

    DA CONTROLLARE ASSOLUTAMENTE

    LA 3 COLONNA c IN EXCEL:  METTE COMPONENTI PC---> MODULI MEMORIA ----> MASTERIZZATORIDVD INTERNI???

    FUTURES
    INSERIRE I LOG , ADESSO SOLO SULL EXCEL
#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here
#include <IE.au3>
#include <MsgBoxConstants.au3>
#include <StringConstants.au3>
#include <InetConstants.au3>
#include <WinAPI.au3>
#include <WinAPIsysinfoConstants.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
#include <Misc.au3>
#include <INet.au3>
#include <Excel.au3>
#include <File.au3>
#include <Array.au3>

_IEErrorHandlerRegister(_User_ErrFunc)

If ProcessExists("iexplore.exe") Then ; Check if the internet esplorer process is running.
    ProcessClose("iexplore.exe")
EndIf
If ProcessExists("EXCEL.exe") Then ; Check if the excel process is running.
    ProcessClose("EXCEL.exe")
EndIf


Global $iGRitardo = 2000, $oIE, $sGName4ExcelG1
Global $aGArray, $aGArray1, $sGName4ExcelG2, $sGName4ExcelG3, $iGTimeToCeck = "6000", $iGTimeOut = "60000"
Global $iGCTRLExTrktOrNOT = 0, $iGPageDynamo = 3, $iGCTRLcreateGroup3 = 0

; variabili relative all excel
Global $oWorkbook, $A_excel = 2, $B_excel = 2, $C_excel = 2, $D_excel = 2, $E_excel = 2, $F_excel = 2, $G_excel = 2, $H_excel = 2
;Global $I = 1, $J = 1, $K = 1, $L = 1, $I_P = 0,
Global $NumB_excell_riga = 2, $H_excel_360 = 2

_EXCEL_CREA()

Func _EXCEL_CREA()
    ConsoleWrite('@@ (666) :(' & @MIN & ':' & @SEC & ') _EXCEL_CREA()' & @CR) ;### Function Trace

    Local $oAppl = _Excel_Open()
    If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_BookOpen Example", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended)

    $oWorkbook = _Excel_BookNew($oAppl)

    _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, "Categoria", "A1")
    _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, "Sotto Categoria", "B1")
    _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, "Sotto Sotto Categoria", "C1")
    _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, "Codice", "D1")
    _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, "Descrizione", "E1")
    _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, "", "F1")
    _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, "Disponibilita", "G1")
    _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, "Arrivi", "H1")
    _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, "Listino", "I1")
    _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, "Margine", "J1")
    _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, "Prezzo c&c", "K1")
    _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, "Prezzo Web", "L1")

EndFunc   ;==>_EXCEL_CREA
Func _User_ErrFunc($oError)
    ConsoleWrite('@@ (830) :(' & @MIN & ':' & @SEC & ') _User_ErrFunc()' & @CR) ;### Function Trace
    ; Do anything here.
    ConsoleWrite(@ScriptFullPath & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _
            @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _
            @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _
            @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _
            @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _
            @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _
            @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _
            @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _
            @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _
            @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF)
EndFunc   ;==>_User_ErrFunc

return me always t his  error

--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
@@ (666) :(49:51) _EXCEL_CREA()
@@ (830) :(49:51) _User_ErrFunc()
C:\Users\SviluppoGest\Desktop\da-cancellare\test.au3 (65) : ==> COM Error intercepted !
    err.number is:      0x80020006
    err.windescription: Unknown name.

    err.description is:     
    err.source is:      
    err.helpfile is:    
    err.helpcontext is:     
    err.lastdllerror is:    0
    err.scriptline is:  65
    err.retcode is:     0x00000000

+>12:49:52 AutoIt3.exe ended.rc:0
+>12:49:52 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 2.122

is possible  to resolve???

thankz

 

Link to comment
Share on other sites

How many of the cells you process in _EXCEL_CREA do get written to Excel - means: What does the worksheet show you?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

  • Developers

That is the result of the test whether Excel is already running or not (Line 65 in Excel.au3) testing for an existing object. 

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

You can ignore this error. It is caused by the Excel UDF function _Excel_Open() which by default tries to open an existing instance of Excel before creating a new Excel instance. The error is raised when _Excel_Open() tries to open an instance of Excel that does not exist before opeing a new instance. Since you  want  a new instance you could change

Local $oAppl = _Excel_Open()

to

Local $oAppl = _Excel_Open(True,False,True,True,True)

 

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Link to comment
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
 Share

  • Recently Browsing   0 members

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