ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   determine range for printed pages (https://www.excelbanter.com/excel-programming/373604-determine-range-printed-pages.html)

dk

determine range for printed pages
 
The following code returns the page count for printed pages - Is it
possible to also find out the range for each page which will be printed,
based on this page count?

PageCount = 0
For Each sht In Worksheets
sht.Activate
Pages = ExecuteExcel4Macro("Get.Document(50)")
PageCount = PageCount + Pages
Next sht
MsgBox "Total Pages = " & PageCount

tia,
dk

Héctor Miguel

determine range for printed pages
 
hi, dk !

The following code returns the page count for printed pages
Is it possible to also find out the range for each page which will be printed, based on this page count?
PageCount = 0
For Each sht In Worksheets
sht.Activate
Pages = ExecuteExcel4Macro("Get.Document(50)")
PageCount = PageCount + Pages
Next sht
MsgBox "Total Pages = " & PageCount


AFIAK, for each 'sht' it should be the usedrange.address...
unless, you have a customized printarea, printtitlerows/columns, ???
where you would need to find out through each 'sht' pagesetup properties

hth,
hector.




All times are GMT +1. The time now is 06:03 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com