FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour ayuda con Excel
Posts: 31
Joined: Fri Mar 17, 2006 02:04 PM
ayuda con Excel
Posted: Mon Mar 30, 2009 09:20 PM
amigos

ayuda por favor....

abro un planilla excel para cargar sus datos en una dbf al abrirla y leer sus datos no tengo problema, pero si cancelo la apertura aparece este error y me bota el exe.

Error occurred at: 30/03/2009, 17:00:25
Error description: Error Excel.Application:WORKBOOKS/16389 E_FAIL: OPEN
Args:
[ 1] = C

Stack Calls
===========
Called from: win32ole.prg => TOLEAUTO:OPEN(0)
Called from: FT201b.prg => T201B:IMPORTAR_DATOS(288)
Called from: FT201b.prg => (b)T201B:NEW(190)
Called from: BTNBMP.PRG => TBTNBMP:CLICK(0)
Called from: BTNBMP.PRG => TBTNBMP:LBUTTONUP(0)
Called from: WINDOW.PRG => TWINDOW:HANDLEEVENT(0)
Called from: CONTROL.PRG => TBTNBMP:HANDLEEVENT(0)
Called from: WINDOW.PRG => _FWH(0)
Called from: => WINRUN(0)
Called from: WINDOW.PRG => TMDIFRAME:ACTIVATE(0)
Called from: FT.prg => TAPP:NEW(307)
Called from: FT.prg => MAIN(114)

este el código de apertura y funciona perfecto

Local oExcel, oHoja, nRow, nCols, aFor, bFor, nAt, aDatos := Array(03)

oExcel := TOleAuto():New( "Excel.Application" )
oExcel:WorkBooks:Open(cGetFile("*.XLS", "Seleccione Fichero"))
oHoja := oExcel:Get( "ActiveSheet" )

nRows := oHoja:UsedRange:Count()
nCols := oHoja:UsedRange:Count()
FOR aFor = 1 to nRows
For bFor =1 to nCols
nAt := Len( aDatos )
xValue := oHoja:Cells(aFor,bFor):Value
aDatos[nAt][bFor] := xValue
SysRefresh()
NEXT
Memory(-1)
NEXT
oExcel:Quit()

....
...

Alguna ayuda....
Posts: 1144
Joined: Mon Feb 05, 2007 07:15 PM
Re: ayuda con Excel
Posted: Mon Mar 30, 2009 09:46 PM

creo que hay que ayudarle un poquito a la apertura..

cFile := cGetFile("*.XLS", "Seleccione Fichero")
if empty( cFile)
retur nil
endif

oExcel:WorkBooks:Open( cFile )

Cesar Cortes Cruz

SysCtrl Software

Mexico



' Sin +- FWH es mejor "

Continue the discussion