RE:Trabajo con Excel
Publicado por
Antonio (1 intervención) el 24/12/2009 09:20:53
Hola JuanC,
muchas gracias por tus ayudas, pero ¿cómo puedo añadir una hoja nueva al excel desde borland builder?,
Variant Excel,Libro,Hoja,Celda;
Excel = CreateOleObject("Excel.Application");
Excel.OlePropertySet("Visible", true);
Libro=Excel.OlePropertyGet("Workbooks");
Libro.OleProcedure("Add");
//Libro.OleProcedure("Add");
Hoja=Libro.OlePropertyGet("Item",1);
Libro=Hoja.OlePropertyGet("Worksheets");
Libro.OlePropertyGet("Item",1).OlePropertySet("Name","Escaleras");
Libro.OlePropertyGet("Item",2).OlePropertySet("Name","Escalera 2");
Libro.OlePropertyGet("Item",3).OlePropertySet("Name","Escalera 3");
//Libro.OlePropertyGet("Item",4).OlePropertySet("Name","Escalera 4");
//Libro.OlePropertyGet("Item",5).OlePropertySet("Name","Escalera 5");
Aquí decalro la hoja, pero como por defecto viene 3 hojas en excel, al acceder a la cuarta me da error, ¿podríais decirme el comando que necesito?
Gracias
AntonioC