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)?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
are you looking for ActiveSheet.PageSetup.Pages.Count
?
回答2:
PageSetup.Pages.Count will give the correct answer. But how to fetch the correct count if comments are printed at end of sheet.
回答3:
Just use
"ActiveWindow.SelectedSheets.PrintOut From:=1, To:=1, Copies:=1, Collate:=True, IgnorePrintAreas:=False"
Change "From" and "To" to your pages.