View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rob van Gelder[_4_] Rob van Gelder[_4_] is offline
external usenet poster
 
Posts: 1,236
Default how can one put the name of the user at the footer of a sheet

From VBA, doubleclick the ThisWorkbook module and insert this code:

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

If you would rather not rely on Application.Username, there are API
solutions to finding username:
Do an groups search for GetUserNameA vb api


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Omar" wrote in message
...
Guys,

How can we make the footer of a sheet shows the name of the user
automatically once a user opens the workbook. So if somebody else opens
it
then the user name will change accordingly.

I had this idea of prompting the user for his/her name and then capturing
it
and putting it at the bottom, but other than that can we capture the same
user name the user has used for his microsoft application.

Regards,