Excel Object Model gives us number of pages on a sheet using api Sheet->PageSetup->Pages->Count
But this count doesn't include the number of pages added because of Comments, which are printed at end of sheet ( a setting that can be made in pagesetup of a sheet)
Can someone please find a resolution to this.
Thanks 开发者_如何学GoHimanshu
do the page breaks appear correctly in Excel display?
if so, you can try this code:
Sub HowManyPagesBreaks()
Dim iHpBreaks As Integer, iVBreaks As Integer
Dim iTotPages As Integer
iHpBreaks = ActiveSheet.HPageBreaks.Count + 1
iVBreaks = ActiveSheet.VPageBreaks.Count + 1
iTotPages = iHpBreaks * iVBreaks
MsgBox "This sheet will require " & iTotPages & _
" page(s) to print", vbInformation, "OzGrid.com"
End Sub
found here
精彩评论