ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how can one put the name of the user at the footer of a sheet (https://www.excelbanter.com/excel-programming/324144-how-can-one-put-name-user-footer-sheet.html)

OMAR

how can one put the name of the user at the footer of a sheet
 
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,

Rob van Gelder[_4_]

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,




OMAR

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

I will try it and see if it works.

ANyhow thanks,

"Rob van Gelder" wrote:

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,






All times are GMT +1. The time now is 12:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com