![]() |
Add page breaks from VB
using VB 6, and Excel 2002, (sp2),
I am trying to add page breaks to an excel workseheet using OLE Automation from a VB program. I have tried XLworksheet.HPageBreaks.Add Befo=ActiveCell XLWorksheet.HPageBreaks.Add ExcelWrkSheet.Cells(1, 1) and various other things suggested on the newsgroups and helper web sites. The VB program will compile ok, but when it tires to execute the HPageBeask.add I get Run time error 1004 application defined or object-defined error '---------------------------------------------------------------------- Microsoft has this as is documentation on this Add method as it applies to the HPageBreaks object. Adds a horizontal page break. Returns an HPageBreak object. expression.Add(Before) expression Required. An expression that returns an HPageBreaks object. Before Required Object. A Range object. The range above which the new page break will be added. '----------------------------------------------------------------------- Thanks in Advance, Laurence Nuttall Programmer Analyst III UCLA - Division of Continuing Education |
Add page breaks from VB
I get that error if I try to use the top left cell or any cell on the top
row. Using the same syntax, it works on another cell. also XLWorksheet.HPageBreaks.Add ExcelWrkSheet.Cells(1, 1) xlWorksheet and ExcelWrkSheet should be the same object/worksheet I would think. -- Regards, Tom Ogilvy "Laurence Nuttall" wrote in message ... using VB 6, and Excel 2002, (sp2), I am trying to add page breaks to an excel workseheet using OLE Automation from a VB program. I have tried XLworksheet.HPageBreaks.Add Befo=ActiveCell XLWorksheet.HPageBreaks.Add ExcelWrkSheet.Cells(1, 1) and various other things suggested on the newsgroups and helper web sites. The VB program will compile ok, but when it tires to execute the HPageBeask.add I get Run time error 1004 application defined or object-defined error '---------------------------------------------------------------------- Microsoft has this as is documentation on this Add method as it applies to the HPageBreaks object. Adds a horizontal page break. Returns an HPageBreak object. expression.Add(Before) expression Required. An expression that returns an HPageBreaks object. Before Required Object. A Range object. The range above which the new page break will be added. '----------------------------------------------------------------------- Thanks in Advance, Laurence Nuttall Programmer Analyst III UCLA - Division of Continuing Education |
All times are GMT +1. The time now is 12:33 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com