Get number of pages for printing from Excel Interopb

前端 未结 3 966
刺人心
刺人心 2021-01-25 00:41

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条回答
  • 2021-01-25 00:43

    Just use

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

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

    0 讨论(0)
  • 2021-01-25 00:58

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

    0 讨论(0)
  • 2021-01-25 01:01

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

    0 讨论(0)
提交回复
热议问题