Thread: number of pages
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
NickHK[_3_] NickHK[_3_] is offline
external usenet poster
 
Posts: 415
Default number of pages

Maybe this method gives better results.
http://j-walk.com/ss/excel/tips/tip65.htm

NickHK

"Monte0682"
groups.com...
I use this

Sub NumberOfPrintedPages()
Worksheets(1).DisplayAutomaticPageBreaks = True
HorizBreaks = Worksheets(1).HPageBreaks.Count
HPages = HorizBreaks + 1
VertBreaks = Worksheets(1).VPageBreaks.Count
VPages = VertBreaks + 1
NumPages = HPages * VPages
Worksheets(1).DisplayAutomaticPageBreaks = False
MsgBox NumPages
End Sub

But sometimes it gives me 1 more page then it really is. So it adds
extra vertical break. How is it possible to trouble shoot this