Solved Close application if a certain account is viewing it

July 15, 2012 at 08:52:45
Specs: Windows XP
Please help!!!!!

I need a way in Visual Basic (regular kind not .net or script) to find out if a certain user is seeing an application. I want it so that if a certain user is seeing the application, say Jim, the program closes. But not for other users, just Jim. I want the program to be able to figure out if this is true: C:\Documents and Settings\Jim . I have looked at other websites and found this code but it doesn't work:
-----------------------------------------------
MsgBox(Environ("USERNAME"))
-----------------------------------------------
All it does is states the user's name, but I want a condition:
--------------------------------------------------------------------------------------
If MsgBox(Environ("USERNAME")) = "Jim" Then
Me.Close()
End If
--------------------------------------------------------------------------------------
Can anyone help??????? Please!!
Please write back ASAP and try to make the code customized to my benefit!!!!!
Thanks.


See More: Close application if a certain account is viewing it

Report •

#1
July 15, 2012 at 09:01:09
✔ Best Answer
Surely you just want:

If Environ("USERNAME") = "Jim"


Report •

#2
July 15, 2012 at 10:15:57
Thank you very much for helping me out!!!!!
:-)

Report •
Related Solutions


Ask Question