Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Servers
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

 
 
Herramientas Buscar en Tema Desplegado
  #2  
Antiguo 10-02-2006
Avatar de OSKR
OSKR OSKR is offline
Miembro
 
Registrado: nov 2004
Ubicación: San Cristóbal/Táchira/Venezuela
Posts: 389
Poder: 22
OSKR Va por buen camino
Creo recordar haber respondido esto antes pero eso fue hace mucho antes, yo uso algo asi y nada de excepciones:
Código:
//Para abrir excel
Variant xlApp;
xlApp = CreateOleObject("Excel.Application");
//hacer visible EXCEL
xlApp.Exec(PropertySet("Visible") << true);
//Acceso a un objeto libro
Variant xlBooks = xlApp.Exec(PropertyGet("Workbooks"));
//crea un nuevo archivo
xlBooks.Exec(Procedure("Add"));
//elige el primer libro de la aplicación
Variant xlBook = xlBooks.Exec(PropertyGet("Item") << 1);
//crea un acceso a un objeto hoja
Variant xlSheets = xlBook.Exec(PropertyGet("Worksheets"));
//Elige una hoja
Variant xlSheet = xlSheets.Exec(PropertyGet("Item") << 1);
//En esta parte es en donde agregas los datos
Variant VRange;
VRange = xlSheet.Exec(PropertyGet("Range") << "A4");
VRange.Exec(PropertySet("Value") << "RUT");
VRange = xlSheet.Exec(PropertyGet("Range") << "B4");
VRange.Exec(PropertySet("Value") << "NOMBRE");
int fila=5;
VRange = xlSheet.Exec(PropertyGet("Range") << "A"+IntToStr(fila));
VRange.Exec(PropertySet("Value") << Edit1->Text);
VRange = xlSheet.Exec(PropertyGet("Range") << "B"+IntToStr(fila));
VRange.Exec(PropertySet("Value") << Edit2->Text);
fila++;
//Guarda el archivo
xlBook.Exec(Procedure("SaveAs") << "\\archivo.xls");
//-------- Cierra excel
//xlApp.Exec(PropertySet("Visible") << false);
xlApp.Exec(Procedure("Quit"));
xlApp.Clear();
__________________
Los Estados Unidos parecen destinados por la Providencia para plagar la América de miserias a nombre de la libertad."
Simón Bolívar
(Carta al Coronel Inglés Patricio Cambell 05/08/1829).
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Llevar desde Excel a una BD paradox DarkSide Servers 39 08-09-2011 14:58:23
Esperar hasta que se cierre Excel Er_Manué Varios 2 28-10-2005 04:08:18
Cerrar Excel EstebanWeb Servers 5 20-12-2004 10:05:02
Cerrar excel desde una aplicaion delphi VolaRe Servers 0 02-05-2004 20:41:20
al cerrar un libro se me cierra el Excel! haron Servers 0 30-05-2003 11:07:26


La franja horaria es GMT +2. Ahora son las 17:14:35.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi