This may help
Dont know about VB, but in vba in excel, add a module and put the code below in. Then in any cell on your spreadsheet you can put =getuser()
Hope this helps.
Function GetUser()
GetUser = Environ("Username")
End Function
Hi
It's the same in VB/VBA just add the code to point to an object on the form and put the code into the initialize event, for example.
eg
Code:
Private Sub UserForm_Initialize()
Me.Caption = Environ("Username")
Me.Label1 = Environ("Username")
Me.TextBox1 = Environ("Username")
End Sub
xlbo has a FAQ showing how you can create a list of the available Environment variables. Alternatively you can use the SET command in a DOS window.
;-)
If a man says something and there are no women there to hear him, is he still wrong?
The faqs ma'am, just the faqs. Get the best from these forums : faq222-2244
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.