Hello to all the community.
I write to you in order to ask a hand to find the way to print a
progressive number on every executed printout of a determined excel
sheet.
In practical I need to trace the printed publication executed for a
determined sheet, and therefore I deduce that the eventual vba script
must act on event prints, than I have unfortunately not found.
The script would have to be able to increase a counter when it comes
launch the printout from the task bar or print command under file and
possibly rember the last number when i save/close the workbook. The
macro therefore it would not have to be associated to a generic push-
button because this would force me to inhibit the press from the task
bar.
Tnx in advance to anyone can give to me one solution.
Pet
ruic - 16 Mar 2007 16:09 GMT
You probably want Workbook BeforePrint event.

Signature
Rui
> Hello to all the community.
>
[quoted text clipped - 16 lines]
>
> Pet
Gord Dibben - 16 Mar 2007 20:34 GMT
Ron de Bruin's macro will enter a consecutive number in A1 of sheet every time
it is printed.
Sub PrintCopies_ActiveSheet_2()
' This example print the number in cell A1
Dim CopiesCount As Long
Dim CopieNumber As Long
CopiesCount = Application.InputBox("How many Copies do you want", Type:=1)'
enter 1 and sheet prints out and A1 gets the number 1
'next time you print enter 1 and sheet prints out and A1 changes to 2
With ActiveSheet
If Not IsNumeric(.Range("A1").Value) Then .Range("A1").Value = 0
For CopieNumber = 1 To CopiesCount
.Range("A1").Value = .Range("A1").Value + 1
'Print the sheet
.PrintOut
Next CopieNumber
End With
End Sub
Gord Dibben MS Excel MVP
>You probably want Workbook BeforePrint event.
>
[quoted text clipped - 18 lines]
>>
>> Pet