HARBOUR 3.2 Y EXCEL 2013(SOLUCIONADO)

HARBOUR 3.2 Y EXCEL 2013(SOLUCIONADO)

Postby Patricio Avalos Aguirre » Mon Jun 02, 2014 2:44 pm

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..
Last edited by Patricio Avalos Aguirre on Mon Jun 02, 2014 3:33 pm, edited 1 time in total.
Saludos
Patricio

__________________________________________________________________
Version: Harbour 3.2.0dev (r1307082134),Compiler: Borland C++ 5.8.2 (32-bit)
PCode version: 0.3, FWH 13.2
http://www.sialm.cl
User avatar
Patricio Avalos Aguirre
 
Posts: 1060
Joined: Fri Oct 07, 2005 1:56 pm
Location: La Serena, Chile

Re: HARBOUR 3.2 Y EXCEL 2013

Postby Patricio Avalos Aguirre » Mon Jun 02, 2014 3:32 pm

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)

 
Saludos
Patricio

__________________________________________________________________
Version: Harbour 3.2.0dev (r1307082134),Compiler: Borland C++ 5.8.2 (32-bit)
PCode version: 0.3, FWH 13.2
http://www.sialm.cl
User avatar
Patricio Avalos Aguirre
 
Posts: 1060
Joined: Fri Oct 07, 2005 1:56 pm
Location: La Serena, Chile

Re: HARBOUR 3.2 Y EXCEL 2013(SOLUCIONADO)

Postby Armando » Mon Jun 02, 2014 4:26 pm

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
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Armando
 
Posts: 3092
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 77 guests