View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rich[_14_] Rich[_14_] is offline
external usenet poster
 
Posts: 8
Default xl97 delete phantom pgBreaks in VBA?

I did one experiment where I set the print area to
something like A1:O42 (my first phantom pb is at A43 in
this one sheet). So now the sht.Hpagebreaks.Count is 0.
But if I set the the print area to A1:O46, then the
phantom pagebreak shows up again. As far as pagebreaks
go, the phantom pb's don't interfere with printing
operations. But I want to reset the pagebreaks according
to how much data I have in a given sheet. It is very
difficult to loop through the pb collection with these
phantom pb's. If anyone knows how to deal with this -
please share.

Thanks again,
Rich


-----Original 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
.