ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Determining number of pages (https://www.excelbanter.com/excel-programming/360713-determining-number-pages.html)

bhofsetz[_129_]

Determining number of pages
 

Is there a method to find out the number of pages that will be printe
with VBA code? Somehow invoking the print preview window and the
retrieving the total pages that will be printed automatically.

Thank

--
bhofset
-----------------------------------------------------------------------
bhofsetz's Profile: http://www.excelforum.com/member.php...fo&userid=1880
View this thread: http://www.excelforum.com/showthread.php?threadid=53939


Ron de Bruin

Determining number of pages
 
Hi

You can use

Dim TotPages As Long
TotPages = Application.ExecuteExcel4Macro("GET.DOCUMENT(50)")



--
Regards Ron de Bruin
http://www.rondebruin.nl


"bhofsetz" wrote in message
...

Is there a method to find out the number of pages that will be printed
with VBA code? Somehow invoking the print preview window and then
retrieving the total pages that will be printed automatically.

Thanks


--
bhofsetz
------------------------------------------------------------------------
bhofsetz's Profile: http://www.excelforum.com/member.php...o&userid=18807
View this thread: http://www.excelforum.com/showthread...hreadid=539399




bhofsetz[_130_]

Determining number of pages
 

Thanks Ron. Just what I was after

Is that similar to using BuiltinDocumentProperties ?

I found that in the Excel VBA help but was unsuccessful getting it to
return the number of pages in my worksheet.


--
bhofsetz
------------------------------------------------------------------------
bhofsetz's Profile: http://www.excelforum.com/member.php...o&userid=18807
View this thread: http://www.excelforum.com/showthread...hreadid=539399


Ron de Bruin

Determining number of pages
 
Hi bhofsetz

Never try it but this is not working for me

Sub Test()
With ActiveWorkbook.BuiltinDocumentProperties
MsgBox .Item("Number of pages")
End With
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"bhofsetz" wrote in message
...

Thanks Ron. Just what I was after

Is that similar to using BuiltinDocumentProperties ?

I found that in the Excel VBA help but was unsuccessful getting it to
return the number of pages in my worksheet.


--
bhofsetz
------------------------------------------------------------------------
bhofsetz's Profile: http://www.excelforum.com/member.php...o&userid=18807
View this thread: http://www.excelforum.com/showthread...hreadid=539399





All times are GMT +1. The time now is 01:44 AM.

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