ayuda con Excel

Post Reply
un_jeepero
Posts: 31
Joined: Fri Mar 17, 2006 2:04 pm

ayuda con Excel

Post by un_jeepero »

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:Rows:Count()
nCols := oHoja:UsedRange:Columns: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....
User avatar
sysctrl2
Posts: 833
Joined: Mon Feb 05, 2007 7:15 pm
Contact:

Re: ayuda con Excel

Post by sysctrl2 »

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 "
Post Reply