Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add Page Breaks in Excel sheet from Access doesn't work 1

Status
Not open for further replies.

franksirvent

Programmer
Mar 8, 2002
358
0
0
GB
Hi,

I am creating an excel sheet report from Access data...
The VB code in Access which creates the excel report is all great, except that the Pagebreak I am trying to insert, I get an error...

This is the code which supposely adds a PageBreak in the CELL selected (the_Rows is the row on the excel sheet which changes with a loop)

xlApp.Range("A" & the_Rows).Select
xlApp.ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=ActiveCell

Could anyone advise what is wrong and why is not working?

This is the error I get everytime:
-2147417851 Method Error 'Add' on the object 'HpageBreaks'

Thanks in advance

 



Hi,

Code:
Dim r as range

set r = xlApp.Range("A" & the_Rows)
                            xlApp.ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=r

Skip,
[sub]
[glasses] [red][/red]
[tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top