View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Jim Cone[_2_] Jim Cone[_2_] is offline
external usenet poster
 
Posts: 1,549
Default problem with finding horizontal page breaks


N = objWkBk.Worksheets("Sheet1").HPageBreaks.Count
For X = 1 to N
varArray(X) = objWkBk.Worksheets("Sheet1").HPageBreaks(X).Locati on.Row
'other stuff needed
Next
'---
Might be a problem if the Application is not visible.
My original comments still apply.
--
Jim Cone
Portland, Oregon USA
http://www.mediafire.com/PrimitiveSoftware
(Data Rows Excel add-in: Color rows, Delete rows, Insert rows)




"Keith Willis"

wrote in message
...
Thanks for reply but same error msg

On Nov 3, 2:39 pm, "Jim Cone" wrote:
Try it in PageBreakPreview... ActiveWindow.View = xlPageBreakPreview
You may also have to put a temporary value in an empty cell below your data.
Then remove the temp value when you are done.
--
Jim Cone
Portland, Oregon USA
http://www.mediafire.com/PrimitiveSoftware
(Special Print XL add-in: long columns printed side by side)







"Keith Willis"
wrote in messagenews:
...
Hi


I'm trying to use the following code to get all the horizontal page
breaks


Dim varArray() As Variant
Dim x As Variant
Dim i As Integer


For Each x In objWkBk.Worksheets("sheet1").HPageBreaks
i = i + 1
ReDim Preserve varArray(i)
varArray(i) = x.Location.Row
Next x


objWkBk is in separate instance of excel.
The problem is if there is more than 1 page break the code errors with
a subscript out of range. Any ideas?