Get number of pages to be printed - before print

  • Thread starter Thread starter Les Stout
  • Start date Start date
L

Les Stout

Hi all, is it at all possible to get the number of pages to be printed
with code before you actually print, a si would like to give the user a
warning of the number of pages to be printed & then perhaps an option of
the number of pages to be printed.


Thanks in advance,


Les Stout
 
Solution from KeepItcool (from a Dutch tread):
tread: http://tinyurl.com/d827j

Sub PapierHier()
Const cFml = "GET.DOCUMENT(50,""&O"")"
Dim ws, n&, s$


With Application
For Each ws In ActiveWorkbook.Worksheets
n = .ExecuteExcel4Macro(.Substitute(cFml, "&O", ws.Name))
s = s & n & vbTab & ws.Name & vbNewLine
Next
End With


MsgBox sMsg
End Sub




Greetz,

Rody
 
Hi Less

Dim TotPages As Long
TotPages = Application.ExecuteExcel4Macro("GET.DOCUMENT(50)")
 
Demo'd from the immediate window:

? application.ExecuteExcel4Macro("Get.Document(50,""Sheet1"")")
3

Usage

numPages = application.ExecuteExcel4Macro("Get.Document(50,""Sheet1"")")


or for the activesheet

numpages = application.ExecuteExcel4Macro("Get.Document(50,)")
 
Thanks Ron, works great, maar noch ein vraag. How do you know if it is
checking for portrait or landscape ?

Les Stout
 
Hi Tom & Ron, have answered my own question by trying it out, i see that
it takes whatever the printer setting you have used.
Just a further question is it the function (50)that tells it what to
look for ? If so, were can one get a list of functions that can be used
?

Les Stout
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top