From: Vahid on
Hi,
I would like to extract the total number of pages of an Excel file in a cell
so that it is updated automatically.
I need to mention the total number of the printed pages in my document (This
document contains XX pages and may not be reproduced other than in full).

Can you help me?
From: H�ctor Miguel on
hi, Vahid !

> I would like to extract the total number of pages of an Excel file in a cell so that it is updated automatically.
> I need to mention the total number of the printed pages in my document
> (This document contains XX pages and may not be reproduced other than in full).

*IF* your printed pages refers only to one worksheet (sheet1 ?)
try creating/defining a name using xl4 macro-functions (i.e.)
name formula
nPages =get.document(50+0*now())

use this name on the cell you need to mention that figure (=npages)

hth,
hector.


From: מיכאל (מיקי) אבידן on
If you mean counting the total pages of a WorkSheet (not the entire Workbook)
then try a UDF to be typed inside a VBA Module:
---------------------------
Function PRT_Pages()
With ActiveSheet
.DisplayAutomaticPageBreaks = True
TotPages = (.HPageBreaks.Count + 1) * (.VPageBreaks.Count + 1)
End With
PRT_Pages = "This document contains " & TotPages & " pages and may not
be reproduced other than in full."
End Function
-----------------
It can be easily converted to count the entire WB pages and/or to an
"Before_Print() Event-Macro
Micky


"Vahid" wrote:

> Hi,
> I would like to extract the total number of pages of an Excel file in a cell
> so that it is updated automatically.
> I need to mention the total number of the printed pages in my document (This
> document contains XX pages and may not be reproduced other than in full).
>
> Can you help me?
From: Vahid on
Hi guys,
Many thanks for your help. It works, you're great...