Link to home
Start Free TrialLog in
Avatar of EMCIT
EMCIT

asked on

Whoami

Good Day, I'm looking for VB code that will deliver the UserID/UserName as "\whoami" will do from a command prompt. Any help is appreciated.
Avatar of als315
als315
Flag of Russian Federation image

Like:
Dim obj as object
Set obj = wscript.CreateObject("wscript.network")
MsgBox obj.Username
You can find also otren methods here:
http://www.robvanderwoude.com/vbstech_network_names_user.php
Avatar of EMCIT
EMCIT

ASKER

Thanks for the quick response. I get:

Run Time Error 424
Object Required

Dim obj As Object
Set obj = wscript.CreateObject("wscript.network")   *This line is highlighted
MsgBox obj.UserName
What VB is used?
Avatar of EMCIT

ASKER

VB 6.5 within MS Access 2003
ASKER CERTIFIED SOLUTION
Avatar of als315
als315
Flag of Russian Federation image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You can use also almost same code as in my first comment:
Dim obj As Object
Set obj = CreateObject("wscript.network")
MsgBox obj.UserName
Avatar of EMCIT

ASKER

Thanks so much. Sorry for the confusion.