Insertar salto de linea en Excel / Excel line jump

HMG en Español

Moderator: Rathinagiri

Post Reply
User avatar
CarlosRD
Posts: 63
Joined: Thu Jan 31, 2013 9:20 pm
Location: Orizaba, México

Insertar salto de linea en Excel / Excel line jump

Post by CarlosRD »

Hola a todos / Hi all:

Necesito insertar desde mi aplicacion, un salto de linea en una hoja de excel. He buscado en MICROSOFT TIPS AND TRICKS y no he encontrado la solución, alguien sabe como hacerlo?

*************************

I need to insert in my application, an Excel line jump in a spreadsheet. I´ve been seek in MICROSOFT TIPS AND TRICKS and i have not found a solution. Any one here knows how to do it?

Saludos / Regards. Carlos RD.
Todo en el Nombre de Jesus / All in the name of Jesus
Carlos RD
User avatar
dhaine_adp
Posts: 457
Joined: Wed Aug 06, 2008 12:22 pm
Location: Manila, Philippines

Re: Insertar salto de linea en Excel / Excel line jump

Post by dhaine_adp »

Hi Carlos,

Would you mind to enlighten us a bit regarding "line jump" or would you like to be in the same cell after your routine fill it out with data?

Regards,

Danny
Regards,

Danny
Manila, Philippines
User avatar
CalScot
Posts: 303
Joined: Thu Mar 21, 2013 12:22 am
Location: California

Re: Insertar salto de linea en Excel / Excel line jump

Post by CalScot »

Hi, Carlos.

Not exactly sure what you're trying to do, but have you tried using an Excel Macro?

Regards,
CalScot
User avatar
CarlosRD
Posts: 63
Joined: Thu Jan 31, 2013 9:20 pm
Location: Orizaba, México

Re: Insertar salto de linea en Excel / Excel line jump

Post by CarlosRD »

thank you dany / cal

"line jump" mmm.....

dany:

I did make an application that creates an Excel Spreadsheet and contains data from row1 to rowN in column A.
This data are not the same type, then when i want to print i need to separate this data in groups.
If one of those groups has only 20 rows, i need in one page those 20 rows.

I explain it right?

calscot:
yes, i did a macro, but the instruction "oExcel:WorkSheets(3):cells(ifila3,ncol):HPageBreaks:Add()" does not work.

some idea?

thanks.
Todo en el Nombre de Jesus / All in the name of Jesus
Carlos RD
User avatar
CalScot
Posts: 303
Joined: Thu Mar 21, 2013 12:22 am
Location: California

Re: Insertar salto de linea en Excel / Excel line jump

Post by CalScot »

Hi, Carlos.

Although I used to used to be very familiar with the macro feature in Lotus 1-2-3, I haven't used it so much in Excel (certainly not recently), so I am a bit "rusty".
I can't follow up tonight, but if you haven't posted a resolution by tomorrow, I will try to play around with it to see if I can find something that might help.
If you could post the spreadsheet with some notes ("before & after"?) on what you're trying to do, that might help.

Good luck!
CalScot
User avatar
CarlosRD
Posts: 63
Joined: Thu Jan 31, 2013 9:20 pm
Location: Orizaba, México

Re: Insertar salto de linea en Excel / Excel line jump

Post by CarlosRD »

I´ve been seeking, but nothing. :oops:
Attachments
oexcel.jpg
oexcel.jpg (80 KiB) Viewed 5539 times
Todo en el Nombre de Jesus / All in the name of Jesus
Carlos RD
User avatar
dhaine_adp
Posts: 457
Joined: Wed Aug 06, 2008 12:22 pm
Location: Manila, Philippines

Re: Insertar salto de linea en Excel / Excel line jump

Post by dhaine_adp »

Hi Carlos,

Try adapting the code snippet below on your routine:

Code: Select all

   oSheet := oExcel:ActiveSheet()        // the current active sheet
   oSheet:Range("A27"):Activate()        // position the cursor to the cell to where the page
                                                     //  break will occur
   oWindow := oExcel:ActiveWindow()   // get active window
   oWindow:SelectedSheets():HPageBreaks():Add(oSheet:Range("A27"))  // set horizontal
                                                                                                  // pagebreak
The best thing with this OLE is that it closely resembles the Harbour Classes. See below the VBA Macro vs. HB code:

Code: Select all

Range("A18").Select
ActiveWindow.SmallScroll Down:=12
Range("A27").Select
ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=ActiveCell
and in HB/HMG it becomes:
oWindow := oExcel:ActiveWindow()
oWindow:SelectedSheets():HPageBreaks():Add(oSheet:Range("A27"))
and the rest of the code implementation is shown above. 
It works with MS Excel 2007 and all those that works for me in 2007 is also working at the office which is Excel 2010 without any changes. I hope that works for you too.

Regards,

Danny
Regards,

Danny
Manila, Philippines
User avatar
CarlosRD
Posts: 63
Joined: Thu Jan 31, 2013 9:20 pm
Location: Orizaba, México

Re: Insertar salto de linea en Excel / Excel line jump

Post by CarlosRD »

Hi Danny:

Thanks a lot, i really appreciate your help. It is working.

Regards.
Todo en el Nombre de Jesus / All in the name of Jesus
Carlos RD
User avatar
CalScot
Posts: 303
Joined: Thu Mar 21, 2013 12:22 am
Location: California

Re: Insertar salto de linea en Excel / Excel line jump

Post by CalScot »

Glad to see it's been resolved!
Thanks Danny!
CalScot
Post Reply