Re: last saved by on footer

Giganews Newsgroups
Subject: Re: last saved by on footer
Posted by:  Bob Phillips (bob.philli…@tiscali.co.uk)
Date: Tue, 14 Oct 2003

Hi Ismael,

Do you mean the network user's name or the Excel user name. If the latter,
then put this code in the ThisWorkbook code module

Private Sub Workbook_BeforePrint(Cancel As Boolean)
    ActiveSheet.PageSetup.LeftFooter = Application.UserName
End Sub

If it's the former, it's a bit more complicated, but not too much

Private Declare Function GetUserName Lib "advapi32.dll" _
    Alias "GetUserNameA" _
  (ByVal lpBuffer As String, _
    nSize As Long) As Long

Public Function UserName() As String
Dim sName As String * 256
Dim cChars As Long
    cChars = 256
    If GetUserName(sName, cChars) Then
        UserName = Left$(sName, cChars - 1)
    End If
End Function

Private Sub Workbook_BeforePrint(Cancel As Boolean)
    ActiveSheet.PageSetup.LeftFooter = UserName
End Sub

--

HTH

Bob Phillips
    ... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Ismael" <ibalb…@flewelling-moody.com> wrote in message
news:2ab6201c3927a$307671c0$a60128…@phx.gbl...
> How do I put whoever saved last on the footer or better
> yet whomever is using the file and prints it.

Replies

None

In response to

last saved by on footer posted by Ismael on Tue, 14 Oct 2003