Page 1 of 1

HARBOUR 3.2 Y EXCEL 2013(SOLUCIONADO)

PostPosted: Mon Jun 02, 2014 2:44 pm
by Patricio Avalos Aguirre
Estimado

He estado teniendo problemas con EXcel y harbour

Code: Select all  Expand view
cArch := cGetFile32("Archivos Excel | *.XLS* |" , "Importar desde un archivo",1,,,.T. )
if empty(cArch)
    return
endif

if ( oExcel := CREATEOBJECT( "Excel.Application" ) ) = NIL
    MsgInfo( "No se pudo comunicar con EXCEL", "Usuario" )
    return
endif

oExcel:WorkBooks:Open(cArch )
oHoja := oExcel:ActiveSheet

nRow := oHoja:UsedRange:Rows:Count()

for i := 2 to nRow
     if valtype(oHoja:Cells(i,1):Value) <> "U"
        codExcel := oHoja:Cells(i,1):Value
        IF VALTYPE( CODEXCEL ) <> "C"
            ALERT( CODEXCEL )
            ALERT( oHoja:Cells(i,1):Value )
        ENDIF
...
...
 

el problema esta en que la variable codexcel retorna un ARREGLO
y si coloco oHoja:Cells(i,1):Value returna un character

estare haciendo algo mal al invocar el Excel..

Re: HARBOUR 3.2 Y EXCEL 2013

PostPosted: Mon Jun 02, 2014 3:32 pm
by Patricio Avalos Aguirre
Asi funciona Bien?

que cosas????

Code: Select all  Expand view
for i := 2 to nRow

    codExcel := oHoja:Cells(i,1):Value

    if valtype(codexcel) = "C"
    //if valtype(oHoja:Cells(i,1):Value) <> "U"
        codExcel := strtran( codExcel, "*", "" )
        codExcel := PadR(Alltrim(codExcel ),15)

 

Re: HARBOUR 3.2 Y EXCEL 2013(SOLUCIONADO)

PostPosted: Mon Jun 02, 2014 4:26 pm
by Armando
Patricio:

Por si te sirve de algo

Code: Select all  Expand view
IF oHoja:Cells(i,1):Value <> NIL
.....
.....
 


Sobre todo para las celdas sin valor

Saludos