View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Laurence Nuttall Laurence Nuttall is offline
external usenet poster
 
Posts: 1
Default 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