Jaymin Registered User. Local time Today, 11:09 Joined Oct 24, 2011 Messages 70 Jun 26, 2012 #1 Hope someone can help me, i want to get access to tell me who has loged onto the computer, i know in excel there is a code Code: GetXLUserName this gives you there login name, Peter
Hope someone can help me, i want to get access to tell me who has loged onto the computer, i know in excel there is a code Code: GetXLUserName this gives you there login name, Peter
jdraw Super Moderator Staff member Local time Yesterday, 20:09 Joined Jan 23, 2006 Messages 15,498 Jun 26, 2012 #2 You may try Environ("USERNAME")
G Galaxiom Super Moderator Staff member Local time Today, 12:09 Joined Jan 20, 2009 Messages 12,832 Jun 27, 2012 #3 The weakness with the username environment variable is that it can be changed by the user. This is more reliable: CreateObject("wscript.network").UserName Best encapsulated in a function so the wscript object is destroyed after returning the value.
The weakness with the username environment variable is that it can be changed by the user. This is more reliable: CreateObject("wscript.network").UserName Best encapsulated in a function so the wscript object is destroyed after returning the value.
Jaymin Registered User. Local time Today, 11:09 Joined Oct 24, 2011 Messages 70 Jun 27, 2012 #4 Jdraw and Galaxiom, Thank you for your replies. Galaxiom can you show me how to program what you have suggested encapsulated in a function so the wscript object is destroyed after returning the value Click to expand... Peter
Jdraw and Galaxiom, Thank you for your replies. Galaxiom can you show me how to program what you have suggested encapsulated in a function so the wscript object is destroyed after returning the value Click to expand... Peter
G Galaxiom Super Moderator Staff member Local time Today, 12:09 Joined Jan 20, 2009 Messages 12,832 Jun 27, 2012 #5 If you want to get to it from the whole project (including queries) put it in a Standard Module. Code: Public Function fUserName() fUserName = CreateObject("wscript.network").UserName End Function Use it like this in subs: somevariable = fUserName
If you want to get to it from the whole project (including queries) put it in a Standard Module. Code: Public Function fUserName() fUserName = CreateObject("wscript.network").UserName End Function Use it like this in subs: somevariable = fUserName
Jaymin Registered User. Local time Today, 11:09 Joined Oct 24, 2011 Messages 70 Jun 27, 2012 #6 Galaxiom, Thank you for your help and time, also a quick responce. Peter