开发者

How to fetch Number of pages of excel sheet having comments at end of page

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜