Add page breaks from VB

  • Thread starter Laurence Nuttall
  • Start date
L

Laurence Nuttall

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 Before:=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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top