Crear un libro en excel

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
jucar_es
Posts: 82
Joined: Thu Nov 13, 2008 11:12 pm

Crear un libro en excel

Post by jucar_es »

Buenas tardes a todos
hasta ahora e podido desde HMG crear hojas de excel sin ningun problema, ahora necito poder crear varias hojas dentro de mismo archivo,.

ALGUIEN PUEDE AYUDARME?
User avatar
Alex Gustow
Posts: 290
Joined: Thu Dec 04, 2008 1:05 pm
Location: Yekaterinburg, Russia
Contact:

Re: Crear un libro en excel

Post by Alex Gustow »

jucar_es wrote:Buenas tardes a todos
hasta ahora e podido desde HMG crear hojas de excel sin ningun problema, ahora necito poder crear varias hojas dentro de mismo archivo,.

ALGUIEN PUEDE AYUDARME?
(Goglish = Google + English :) )
jucar_es wrote:Good afternoon everyone
so far and have since HMG create Excel spreadsheets without any problem, now little hands to create multiple sheets within same file.

CAN ANYONE HELP ME?
Hi, jucar_es!
As I think, it's easy (but maybe I'm wrong? correct me, guys):

Code: Select all

oExcel := TOleAuto():New( "Excel.Application" )
oExcel:Sheets:Add() // add one sheet
oExcel:Sheets:Add() // add one more
... etc
I didn't test this sample - only run Excel, run "Service"-"Macros"-"Record" [named it "MyMacros1"]; do what I need; view ("Service"-"Macros"-"Macroses" [Alt+F8] "Edit" MyMacros1) what Excel writes to macro-sub; copy from Excel's Visual Basic window what I need; past to my prog; change "."-s (dots) to ":"-s... something like that...
Maybe it helps you.
joposadas

Re: Crear un libro en excel

Post by joposadas »

Para crear hojas dentro de un libro excel usa esto

oExcel:Sheets("Hoja1"):Name := "Total general"
oExcel:Sheets("Hoja2"):Name := "Total por tipo de pago"
oExcel:Sheets("Hoja3"):Name := "Detalle de las ventas"

Si quieres posicionarte en una hoja entonces usa esto:
oExcel:Sheets("Total general"):Select()
oHoja := oExcel:Get( "ActiveSheet" )
Post Reply