A problem with HPageBreaks
Hello,
I got the trick too. I try to access the Excel Worksheets HPageBreaks. I
can get the COUNT of the HPageBreaks. But when I start to loop the pagebreaks
by using a integer index and the index 1, Microsoft.Office.Interop.Excel
always give me error: €śinvalid index€ť (The object has 17 pagebreaks). It can
get the first pagebreak in the pagebreaks only, not the others. Do you think
this is also related to "Page Break Preview Mode" ?
Thanks,
Larry
"NateBuckley" wrote:
Seems to have done the trick, thanks alot matey.
I owe you a cold frosty beer.
"TomPl" wrote:
Playing with page breaks is a very tricky affair because the automatic page
breaks are generated by excel and are not static. The "Subscript out of
range" might be because excel has not updated the page breaks. I find that
when I open a workbook excel does not see all of the page breaks until I
actually schroll down to the end of the document. Once I schroll down the
automatic page breaks are available to VGA.
A trick that I have used is to switch to "Page Break Preview Mode" which
seems to resolve the problem. Switching to a from "Page Break Preview Mode"
can be done within your code to avoid the hassle of doing it manually.
Hope this helps.
Tom
|