开发者

Get number of pages for printing from Excel Interopb

开发者 https://www.devze.com 2023-01-17 07:29 出处:网络
How can I programatically retrieve the number of pages a workbook or workshe开发者_StackOverflow中文版et will print to from the Excel 2007 Interop (Microsoft.Office.Interop.Excel)?are you looking for

How can I programatically retrieve the number of pages a workbook or workshe开发者_StackOverflow中文版et will print to from the Excel 2007 Interop (Microsoft.Office.Interop.Excel)?


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


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


Just use

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

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

0

精彩评论

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