D
darlove
Hi,
I have just read a quite lengthy conversation on the subject of
removing horizonal and vertical page breaks. Unfortunately, the person
who was hoping to find a solution to the problem here did not find it
then. Maybe today she knows how to achieve the result she wanted to.
The problem is the following. I want to programatically remove all (or
some) horizontal page breaks on a sheet. One suggestion that I've found
here is to type in this piece of code and set in motion:
Sub DeleteHPageBreaks()
Dim pb As HPageBreak
Dim lCount As Long
For lCount = ActiveSheet.HPageBreaks.Count To 1 Step -1
Set pb = ActiveSheet.HPageBreaks(lCount)
If pb.Type = xlPageBreakManual Then pb.Delete
Next lCount
End Sub
Regrettably, it produces an error (1004) which does not say much about
what's really happened. Actually, says nothing at all. I have also
tried a For Next...Loop version of the above with the same result. Is
this a real bug? Could anybody, please, give me an answer?
Darlove (PL)
I have just read a quite lengthy conversation on the subject of
removing horizonal and vertical page breaks. Unfortunately, the person
who was hoping to find a solution to the problem here did not find it
then. Maybe today she knows how to achieve the result she wanted to.
The problem is the following. I want to programatically remove all (or
some) horizontal page breaks on a sheet. One suggestion that I've found
here is to type in this piece of code and set in motion:
Sub DeleteHPageBreaks()
Dim pb As HPageBreak
Dim lCount As Long
For lCount = ActiveSheet.HPageBreaks.Count To 1 Step -1
Set pb = ActiveSheet.HPageBreaks(lCount)
If pb.Type = xlPageBreakManual Then pb.Delete
Next lCount
End Sub
Regrettably, it produces an error (1004) which does not say much about
what's really happened. Actually, says nothing at all. I have also
tried a For Next...Loop version of the above with the same result. Is
this a real bug? Could anybody, please, give me an answer?
Darlove (PL)