Get number of pages for printing from Excel Intero

2019-03-03 07:11发布

How can I programatically retrieve the number of pages a workbook or worksheet will print to from the Excel 2007 Interop (Microsoft.Office.Interop.Excel)?

3条回答
地球回转人心会变
2楼-- · 2019-03-03 07:26

are you looking for ActiveSheet.PageSetup.Pages.Count?

查看更多
我只想做你的唯一
3楼-- · 2019-03-03 07:27

Just use

"ActiveWindow.SelectedSheets.PrintOut From:=1, To:=1, Copies:=1, Collate:=True, IgnorePrintAreas:=False"

Change "From" and "To" to your pages.

查看更多
放荡不羁爱自由
4楼-- · 2019-03-03 07:47

PageSetup.Pages.Count will give the correct answer. But how to fetch the correct count if comments are printed at end of sheet.

查看更多
登录 后发表回答