ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   textbox to return User Name (https://www.excelbanter.com/excel-programming/372933-textbox-return-user-name.html)

ADK

textbox to return User Name
 
If you can, how can I return the User Name in a TextBox on a UserForm.
User Name being the one in Excel|Options|General Tab|User Name:
(Excel 2000)

Thanks,

-ADK



Die_Another_Day

textbox to return User Name
 
UserForm1.TextBox1.Value = Application.UserName

Note: I do not have Excel 2000 to test on. Tested in 2002 & 2003

Charles

ADK wrote:
If you can, how can I return the User Name in a TextBox on a UserForm.
User Name being the one in Excel|Options|General Tab|User Name:
(Excel 2000)

Thanks,

-ADK



Tom Ogilvy

textbox to return User Name
 
It would work back to Excel 97 for sure.
Versions before that didn't have userforms, but I would bet they supported
application.Username at least back to xl5 (before that, no VBA).
--
Regards,
Tom Ogilvy


"Die_Another_Day" wrote:

UserForm1.TextBox1.Value = Application.UserName

Note: I do not have Excel 2000 to test on. Tested in 2002 & 2003

Charles

ADK wrote:
If you can, how can I return the User Name in a TextBox on a UserForm.
User Name being the one in Excel|Options|General Tab|User Name:
(Excel 2000)

Thanks,

-ADK




ADK

textbox to return User Name
 
Like this:

Private Sub TextBox1_Change()
UserForm1.TextBox1.Value = Application.UserName
End Sub

It doesn't seem to show any result in the textbox


"Die_Another_Day" wrote in message
oups.com...
UserForm1.TextBox1.Value = Application.UserName

Note: I do not have Excel 2000 to test on. Tested in 2002 & 2003

Charles

ADK wrote:
If you can, how can I return the User Name in a TextBox on a UserForm.
User Name being the one in Excel|Options|General Tab|User Name:
(Excel 2000)

Thanks,

-ADK





Tom Ogilvy

textbox to return User Name
 
Putting it in the change event wouldn't make much sense.

Change doesn't fire until you enter something in the textbox.

May put the code in

Private Sub Userform_Initialize() ' yes, userform, not userform1
UserForm1.TextBox1.Value = Application.UserName
End Sub

--
Regards,
Tom Ogilvy



"ADK" wrote in message
...
Like this:

Private Sub TextBox1_Change()
UserForm1.TextBox1.Value = Application.UserName
End Sub

It doesn't seem to show any result in the textbox


"Die_Another_Day" wrote in message
oups.com...
UserForm1.TextBox1.Value = Application.UserName

Note: I do not have Excel 2000 to test on. Tested in 2002 & 2003

Charles

ADK wrote:
If you can, how can I return the User Name in a TextBox on a UserForm.
User Name being the one in Excel|Options|General Tab|User Name:
(Excel 2000)

Thanks,

-ADK








All times are GMT +1. The time now is 04:43 AM.

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