ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Footer variable for user name? (https://www.excelbanter.com/excel-programming/353928-footer-variable-user-name.html)

Allison

Footer variable for user name?
 
Is there a variable available for capturing the user name in the footer of a
document?

Similar to "&[Date]" or "&[Time]" as already exists?



Bob Phillips[_6_]

Footer variable for user name?
 
Private Sub Workbook_BeforePrint(Cancel As Boolean)
With ActiveSheet.PageSetup
.LeftFooter = Environ("Username")
End With
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code



--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Allison" wrote in message
...
Is there a variable available for capturing the user name in the footer of

a
document?

Similar to "&[Date]" or "&[Time]" as already exists?





Jim Thomlinson[_5_]

Footer variable for user name?
 
Nothing that I know of. The variables that you speak of are both vloatile
(determined at run time). Name is not determined at run time, so it is just
hard coded in the header/footer. You could easily write some code to put the
name in the footer

Application.UserName 'The name from Tools -Option -General -User Name
or
Environ("UserName") 'The users windows Login Name

If you need more help just let me know...
--
HTH...

Jim Thomlinson


"Allison" wrote:

Is there a variable available for capturing the user name in the footer of a
document?

Similar to "&[Date]" or "&[Time]" as already exists?



Allison

Footer variable for user name?
 
Thanks both of you. I'd seen the VBA code before, but didn't want to go that
route.

Looks like I'm out of luck. Thanks again.

"Allison" wrote:

Is there a variable available for capturing the user name in the footer of a
document?

Similar to "&[Date]" or "&[Time]" as already exists?




All times are GMT +1. The time now is 05:50 PM.

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