View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default xl97 delete phantom pgBreaks in VBA?

Sure you are not seeing automatic pagebreaks?

If the length of the page exceeds what can be printed on the printer in one
page, excel puts in an automatic pagebreak. No way to get around that other
than to put in manual pagebreaks that will fit to the printer page.

--
Regards,
Tom Ogilvy

"Rich" wrote in message
...
Hello,

I was using an example in the Excel97 help files for
looping through a pagebreak collection, but the loop
didn't work.

For Each pb in Worksheets(1).HPageBreaks
...
Next

bombs out right at "For Each pb..." even though I do have
pagebreaks in the worksheet. So I used a For..Next loop.
This was a little better. But if I have 2 pagebreaks that
I did insert, the sht.hpagebreak.count says like 6. So I
loop through the collection and I see a location for
phantom pagebreaks which I cannot remove/delete in VBA. I
did this for several sheets in one workbook and got
different locations for these phantom pagebreaks. Is this
a bug in Excle97 or is there a way to deal with these
underlying pagebreaks? Some obscure Excel constant
maybe? workbook configuration? Any suggestions
appreciated.

Thanks,
Rich