"Printed by:" in Footer

R

Ruan

Hello,

Is there a way to display the User who printed the document in the Footer?

Thanks
Ruan
 
F

Frank Kabel

Hi
Put the following code in your workbook module (not in a standard
module):
Private Sub Workbook BeforePrint(Cancel As Boolean)
Dim wkSht As Worksheet
For Each wkSht In me.Worksheets
With wkSht.PageSetup
.CenterFooter = "Printed by: " & application.username
End With
Next wkSht
End Sub
 
R

Ruan

Thanks Frank,

That worked really great.

Ruan


Frank Kabel said:
Hi
Put the following code in your workbook module (not in a standard
module):
Private Sub Workbook BeforePrint(Cancel As Boolean)
Dim wkSht As Worksheet
For Each wkSht In me.Worksheets
With wkSht.PageSetup
.CenterFooter = "Printed by: " & application.username
End With
Next wkSht
End Sub
 
C

CLR

Frank.........
Is this code intended to return the User that the Excel is installed to, or
the User who signed on the computer?

Vaya con Dios,
Chuck, CABGx3
 
F

Frank Kabel

Hi
the first one :)
For the latter one you'll need a different approach. e.g.

Public Function WinUserName() As String
WinUserName = Environ("UserName")
End Function
 

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

Top