how can one put the name of the user at the footer of a sheet

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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,
 
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
 

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

Back
Top