Excel file open in uniface
Author: dammie@seznam.cz (dammie)
I have this code:
newinstance "EXCEL_APPLICATION", $lh_excel$
$lh_excel$->set_visible(1)
$lh_excel$->get_workbooks( $lh_workbooks$ )
$lh_workbooks$->open( "", "c:\file.xls", "", "", "", "", "", "", "", "", "", "", "", "", "", "" )
and in message I got this error :-(
ICCDRV-COM-ERR Error with ICC system occurred, The COM method "Open" threw an OLE exception: HRESULT=0x800a03ec, description="Metoda Open t?? Workbooks selhala.", source="Microsoft Excel": COM error 0x800a03ec, described as "Unknown error 0x800A03EC" (ICC system status: <-2146827284>)"
Any Hints?
David
7 Comments
Local Administrator
Googling that error message shows the following as a hopeful solution
http://bitterolives.blogspot.co.uk/2009/03/excel-interop-comexception-hresult.html
Author: Iain Sharp (i.sharp@pcisystems.co.uk)
Local Administrator
Hi, I take into account the sample B_EXCEL component given in the site. I have also the same issue "ICCDRV-COM-ERR Error with ICC system occurred, The COM method "Copy" threw an OLE exception: HRESULT=0x800a03ec, description="La m?ode Copy de la classe Sheets a ?ou?, source="Microsoft Excel": COM error 0x800a03ec, described as "Unknown error 0x800A03EC" (ICC system status: <-2146827284>)" When I want to copy a sheet in the same file. The code is : variables handle vExcelHandle ; Signature APPLICATION Classe COM : Excel.Application.14 Handle vWorkBooks ; Signature WORKBOOKS Handle vActiveWorkBook ; Signature U_WORKBOOK Handle vActivecell ; Signature RANGE Handle vActiveSheet ; Signature U_WORKSHEET Handle vWorkBook ; Signature U_WORKBOOK Handle vSheets ; Signature SHEETS string FileName endvariables ;;Import Excel Application signature like this: /sti /mwr=COM /pid Excel.Application ;;; Create instance of Excel newinstance "APPLICATION",vExcelHandle vExcelHandle->SET_VISIBLE(1) ;;; execute Workbooks.get -- creates handle vWorkBooks for more manipulations vExcelHandle->GET_WORKBOOKS(vWorkBooks) FileName = "%%EX_TARGET%%%" ;;; Open spread sheet named in FileName Note: parameter "-" indicates optional parm not included ;vWorkBooks->Open("UT_OPTIONAL", FileName, -, -, -, -, -, -, -, -, -, -, -, -, -, -) ;if ( $status < 0 ) vWorkBooks->add(vActiveWorkBook,-) ; API ;endif ;;; Create handle to active workbook ;API-vExcelHandle->GET_ACTIVEWORKBOOK(vActiveWorkBook) ;;; Needs to create handle to active sheet ( p_workbook->GET_ACTIVESHEET(p_activesheet)) vActiveWorkBook->GET_ACTIVESHEET(vActivesheet) ;;;p_activesheet->GET_RANGE(p_activecell, p_nmrangestart, -) vActivesheet->GET_RANGE(vActivecell, EB_CELL1, -) vActivesheet->SET_NAME("Antoine") ;vActivesheet->add(vWorkBook,-) ; API ;vWorkBook->GET_ACTIVESHEET(vActivesheet) ;;;vActivesheet->GET_RANGE(vActivecell, EB_CELL1,"D8") vActiveWorkBook->GET_WORKSHEETS(vSheets) debug vSheets->COPY("Sheets(Antoine)",-) ; Error vActivesheet->COPY("1",-) ; Error Copy when before and after parameter are - create a new book. See http://msdn.microsoft.com/fr-fr/library/office/ff835605%28v=office.15%29.aspx I would like all sheets in one book.
Author: apicaud (antoine.picaud@free.fr)
Local Administrator
Have you tried vSheets->COPY(vActivesheet,-) I think you need to give it an object not a name?
Author: Iain Sharp (i.sharp@pcisystems.co.uk)
Local Administrator
Hi, Yes, I try your test but it's always wrong.
Author: apicaud (antoine.picaud@free.fr)
Local Administrator
The name of the file should be the first parameter in the open operation of that workbooks signature.
Author: adkinsl (adkins.larry@gmail.com)
Local Administrator
The COM error 0x800a03ec usually means that one of the provided parameters has an incorrect value. In this case you are passing empty strings to parameters that are of type Numeric or Boolean. If a parameter is optional then you need to specify a hyphen (-). For example:
$lh_workbooks$->open( -, "c:\file.xls", -, -, -, -, -, -, -, -, -, -, -, -, -, - ) Hope this helps. Daniel
Author: diseli (daniel.iseli@uniface.com)
Local Administrator
The described problem has been recognized as BUG 30859 ("Calling the Excel method WORKSHEET->copy fails when you specify before/after") and it has been fixed with the version 9.6.07 patch X702. Hope this helps. Daniel
Author: diseli (daniel.iseli@uniface.com)