ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   logon name in footer (https://www.excelbanter.com/excel-programming/345561-logon-name-footer.html)

maryj

logon name in footer
 
I found this code for putting the user name found in Tools, options into the
footer

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

How could this be changed to show the logon name. I tried changing
Application to Environ but that didn't work.

Thanks for your help!!
--
maryj

Chip Pearson

logon name in footer
 
Try

ActiveSheet.PageSetup.RightFooter = Environ("username")


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"maryj" wrote in message
...
I found this code for putting the user name found in Tools,
options into the
footer

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

How could this be changed to show the logon name. I tried
changing
Application to Environ but that didn't work.

Thanks for your help!!
--
maryj




maryj

logon name in footer
 
Perfect!!
--
maryj


"Chip Pearson" wrote:

Try

ActiveSheet.PageSetup.RightFooter = Environ("username")


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"maryj" wrote in message
...
I found this code for putting the user name found in Tools,
options into the
footer

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

How could this be changed to show the logon name. I tried
changing
Application to Environ but that didn't work.

Thanks for your help!!
--
maryj






All times are GMT +1. The time now is 07:19 AM.

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