RE:Datos a excel !! URGENTE !!
Hola te envio el codigo para poder llevar datos a excel, cual quier duda puedes enviarme a mi correo, aa por sia caso sor de BOLIVIA.
Thisform.Label1.Visible=.T.
LOCAL i,j,TrendFunc,xlsheet,XLApp,tmpsheet
** EN ESTA PARTE MEDIANTE SQL BUSCO LOSA CAMPOS QUE QUIERO Y DEACUERDO A UNA CONDICION SI ASI LO QUIERES, Y LO GUARDO EN UN ARRAY
Select Codigo,detalle,Saldoea,saldoep,saldoec from c:\martini\total;
Into Array ArrSalesdata
OleApp=CREATEOBJECT("Excel.Application")
OleApp.WorkBooks.Add
OleApp.Cells(1,1).Value = "CODIGO"
Oleapp.Cells(1,1).font.bold=.T.
oleapp.Cells(1,1).font.size="12"
oleapp.Cells(1,1).font.name="Arial"
OleApp.Cells(1,2).Value = "DETALLE"
Oleapp.Cells(1,2).font.bold=.T.
oleapp.Cells(1,2).font.size="12"
oleapp.Cells(1,2).font.name="Arial"
OleApp.Cells(1,3).Value = "ANTERIOR"
Oleapp.Cells(1,3).font.bold=.T.
oleapp.Cells(1,3).font.size="12"
oleapp.Cells(1,3).font.name="Arial"
OleApp.Cells(1,4).Value = "PERIODO"
Oleapp.Cells(1,4).font.bold=.T.
oleapp.Cells(1,4).font.size="12"
oleapp.Cells(1,4).font.name="Arial"
OleApp.Cells(1,5).Value = "ACTUAL"
Oleapp.Cells(1,5).font.bold=.T.
oleapp.Cells(1,5).font.size="12"
oleapp.Cells(1,5).font.name="Arial"
*** HASTA QUI SOLAMENTE PUSE LOS TITULOS
*** ESTE FOR ES EL QUE DESCARGA LA INFORMACION EL VALOR _TALLY ES **LA CANTIDAD DE REGISTROS DE MI COLSULTA
** EL FOR J TIENE UN VALOR DE 5 QUE ES EL NUMERO DE TITULOS QUE ***COLOCARE COMO PUEDES VER EN MI CASO ES 5 `PUEDE SER 10 11 O LO **QUE NECESITES CAMBIAS ARRIBA Y TAMBIEN EN ESTE FOR
FOR i = 1 to _TALLY
FOR j = 1 to 5
OleApp.Cells(i+1,j).Value =arrSalesData(i,j)
ENDFOR
ENDFOR
OleApp.Visible=.T.
*** LISTO TODO UNA BELLEZA***
SALUDOS ESPERO TE SEA UTIL