Excel97: Testing for More than One Page

D

Demosthenes

Using Excel97 I want to test for more than one page. The only solution I
have been able to find is slow, kludgy, and unsatisfying. I cannot even
verify it works in all cases. It is as follows:

If ExecuteExcel4Macro("Get.Document(50)") > 1 Then
....
End If


I have attempted to use (Worksheet).VPageBreaks.Count, but it returns "1"
whether I have one page or two.

Is there a better solution?
 
E

Earl Kiosterud

Demosthenes,

Maybe you could pattern it after a search for page breaks. This looks down
for automatic page breaks, vertically only:

LastRow = ActiveSheet.UsedRange.Row + ActiveSheet.UsedRange.Rows.Count
For roww = 1 To LastRow
Application.StatusBar = roww ' it's slow -- this indicates the progress
If Cells(roww, 1).EntireRow.PageBreak = xlPageBreakAutomatic Then
MsgBox roww & " contains a page break" ' add 'em up here
End If
Next roww
 
D

Demosthenes

Thanks for the suggestion.

I monkeyed around with your code for awhile, got it running a little faster,
but "Cells(roww,10.EntireRow.PageBreak" just takes too long and I couldn't
find any way around it.

I ended up using:

If ActiveSheet.UsedRange.Rows.Count > 50
....
End If

It's not perfect, but it suits my need.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top