A
Alex T
Folks...
I am seeing some odd results with the behavior of the HPageBreaks
collection.
Have a look to the following code
---------------------------------------------------------------
Sub testHB()
Dim mySheet As Worksheet
Dim numItems As Integer
Dim i As Integer
Dim tmpBuf As String
Set mySheet = ActiveSheet
numItems = mySheet.HPageBreaks.Count
For i = 1 To numItems
tmpBuf = mySheet.HPageBreaks.Item(i).Location.Address
MsgBox tmpBuf
Next i
End Sub
---------------------------------------------------------------
For some reason it does fail with a "subscript out of range" error in
a not fully reproducible way (sometimes it works, sometimes it does
not) when trying to dereference item(i) with I being > 1 and numItems
Any pointer / suggestion welcome !
Regards
--alexT
I am seeing some odd results with the behavior of the HPageBreaks
collection.
Have a look to the following code
---------------------------------------------------------------
Sub testHB()
Dim mySheet As Worksheet
Dim numItems As Integer
Dim i As Integer
Dim tmpBuf As String
Set mySheet = ActiveSheet
numItems = mySheet.HPageBreaks.Count
For i = 1 To numItems
tmpBuf = mySheet.HPageBreaks.Item(i).Location.Address
MsgBox tmpBuf
Next i
End Sub
---------------------------------------------------------------
For some reason it does fail with a "subscript out of range" error in
a not fully reproducible way (sometimes it works, sometimes it does
not) when trying to dereference item(i) with I being > 1 and numItems
having two or more members...= 2 (i.e. when accessing HPageBreaks(2) or greater in a collection
Any pointer / suggestion welcome !
Regards
--alexT