LOCAL oExcel, oHoja, nRows, nCols
LOCAL TCampos:={}, nRow, nCol
oExcel := TOleAuto():New( "Excel.Application" )
*oExcel:Visible := .T. // por si quieres ver la hoja abierta
oExcel:WorkBooks:Open(cGetFile("*.XLS", "Seleccione Fichero"))
oHoja := oExcel:Get( "ActiveSheet" )
nRows := oHoja:UsedRange:Rows:Count()
nCols := oHoja:UsedRange:Columns:Count()
USE <tu dbf>
FOR nRow := 2 TO nRows
APPEND BLANK
FOR nCol := 1 TO nCols
xValue := oHoja:Cells(nRow,nCol):Value
FieldPut(nCol,xValue)
SysRefresh()
NEXT
DBCOMMIT()
Memory(-1)
NEXT
oExcel:Quit()
oHoja:End()
oExcel:End()
QAZWSX2K wrote:ando en eso mismo desde hace como 2 meses y he probado una tal clase toleauto pero lamento decepcionarte que no me sirve, si lo logro hacer te paso el dato mientras puedes probar tu a ver si esa clase te sirve
QAZWSX2K wrote:estimado rene pudistes haberme contestado eso a mi tanbien hace mas de un mes que pregunte por eso y solo me ayudastes diciendo que a lo mejor tenia excel incompleto, de todos modos gracias
RF wrote:QAZWSX2K wrote:estimado rene pudistes haberme contestado eso a mi tanbien hace mas de un mes que pregunte por eso y solo me ayudastes diciendo que a lo mejor tenia excel incompleto, de todos modos gracias
HQJ (Hay que jo...) ahora resulta que tengo que dar soluciones concretas en momentos especificos.... ya me vale
Ha veces soy tan irresponsable.... que yo mismo me sorprendo
oExcel := TOleAuto():New( "Excel.Application", .F. )
oExcel:WorkBooks:Open( cFilePath )
oExcel:Sheets( 1 ):Select()
oHoja := oExcel:Get( "ActiveSheet" )
nTotalRows := oHoja:UsedRange:Rows:Count()
for nRow := 8 to nTotalRows
...
next
oExcel:WorkBooks:Close()
oExcel:Quit()
oExcel:End() [b]me devuelve error[/b]
oExcel := NIL
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: Google [Bot], nageswaragunupudi and 41 guests