← Foro de Visual FoxPro

VF con excel...URGE¡¡¡¡¡¿

Hilo en el foro de Visual FoxPro · 26 de Diciembre del 2003 · 1 respuestas
GABRIEL26 de Diciembre del 2003
Pregunta
hola.... necesito su ayuda, supongamos que tengo un formato en excel y necesito que al momento de hacer una consulta en foxpro me mande el resultado a esa hoja de excel, por ejemplo que la clave me la posicione en una columna determinada.... se podrá....??? de antemano muchas gracias....

Respuestas 1

orve26 de Diciembre del 2003
Mira este es un programa que toma una tabla de visual foxpro y la envía a una hoja de cálculo Excel. Espero que te sirva.

tmpsheet = GetObject('','excel.sheet')
XLApp = tmpsheet.application
XLApp.Visible = .t.
XLApp.WorkBooks.Add()
XLSheet = XLApp.ActiveSheet
XLSheet.Cells(07,01).Value = 'CENTRO'
XLSheet.Cells(07,03).Value = 'TOTAL'
XLSheet.Cells(07,04).Value = 'CREDITO'
XLSheet.Cells(07,05).Value = 'CONTADO'
i=9
STORE 0 TO tot1,tot2,tot3
SELECT tableta
GO TOP
DO WHILE !EOF()
XLSheet.Cells(i,01).Value = tableta.clicod1
XLSheet.Cells(i,02).Value = tableta.cliciu
XLSheet.Cells(i,03).Value = tableta.total
XLSheet.Cells(i,04).Value = tableta.totcre
XLSheet.Cells(i,05).Value = tableta.total-tableta.totcre
tot1=tot1+tableta.total
tot2=tot2+tableta.totcre
tot3=tot3+(tableta.total-tableta.totcre)
i=i+1
SKIP
ENDDO
i=i+1
XLSheet.Cells(i,01).Value = 'TOTALES'
XLSheet.Cells(i,03).Value = tot1
XLSheet.Cells(i,04).Value = tot2
XLSheet.Cells(i,05).Value = tot3
WAIT WINDOW NOWAIT 'Proceso Terminado'
¿Buscas más hilos como este? Mira el foro de Visual FoxPro o usa el buscador.