Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Getting Computer name and User Name
Getting Computer name and User Name
----------------------------------------- Is it possible to get the name of the Computer using vba? (i.e. debug.print computerName) PS. How can you get the user name from the loged in user in a network (without using application.username)? What I want to know is who is the person using my program and which PC is he or she using. Thank you for helping. Jan |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Getting Computer name and User Name
debug.print environ("computername")
and debug.print environ("username") -- HTH RP (remove nothere from the email address if mailing direct) "Jan G. Thorstensen" wrote in message ... Getting Computer name and User Name ----------------------------------------- Is it possible to get the name of the Computer using vba? (i.e. debug.print computerName) PS. How can you get the user name from the loged in user in a network (without using application.username)? What I want to know is who is the person using my program and which PC is he or she using. Thank you for helping. Jan |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Getting Computer name and User Name
http://www.erlandsendata.no/english/index.php?t=envbaos
-- Regards, Tom Ogilvy "Jan G. Thorstensen" wrote in message ... Getting Computer name and User Name ----------------------------------------- Is it possible to get the name of the Computer using vba? (i.e. debug.print computerName) PS. How can you get the user name from the loged in user in a network (without using application.username)? What I want to know is who is the person using my program and which PC is he or she using. Thank you for helping. Jan |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Getting Computer name and User Name
Thank you so much!
That did the trick... Jan "Bob Phillips" skrev i melding ... debug.print environ("computername") and debug.print environ("username") -- HTH RP (remove nothere from the email address if mailing direct) "Jan G. Thorstensen" wrote in message ... Getting Computer name and User Name ----------------------------------------- Is it possible to get the name of the Computer using vba? (i.e. debug.print computerName) PS. How can you get the user name from the loged in user in a network (without using application.username)? What I want to know is who is the person using my program and which PC is he or she using. Thank you for helping. Jan |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Getting Computer name and User Name
Hi Tom
Is alvin I have try this but i don't know how to get it to work Public Declare Function GetUserName Lib "advapi32.dll" _ Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long Function ReturnUserName() As String ' returns the NT Domain User Name Dim rString As String * 255, sLen As Long, tString As String tString = "" On Error Resume Next sLen = GetUserName(rString, 255) sLen = InStr(1, rString, Chr(0)) If sLen 0 Then tString = Left(rString, sLen - 1) Else tString = rString End If On Error GoTo 0 ReturnUserName = UCase(Trim(tString)) End Function How to i call the function and how do i get the username i believe the username is in Returnusername? Alvin "Tom Ogilvy" skrev: http://www.erlandsendata.no/english/index.php?t=envbaos -- Regards, Tom Ogilvy "Jan G. Thorstensen" wrote in message ... Getting Computer name and User Name ----------------------------------------- Is it possible to get the name of the Computer using vba? (i.e. debug.print computerName) PS. How can you get the user name from the loged in user in a network (without using application.username)? What I want to know is who is the person using my program and which PC is he or she using. Thank you for helping. Jan |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Getting Computer name and User Name
Sorry i have fout out how
Thanks anyway tom Alvin "Alvin Hansen" skrev: Hi Tom Is alvin I have try this but i don't know how to get it to work Public Declare Function GetUserName Lib "advapi32.dll" _ Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long Function ReturnUserName() As String ' returns the NT Domain User Name Dim rString As String * 255, sLen As Long, tString As String tString = "" On Error Resume Next sLen = GetUserName(rString, 255) sLen = InStr(1, rString, Chr(0)) If sLen 0 Then tString = Left(rString, sLen - 1) Else tString = rString End If On Error GoTo 0 ReturnUserName = UCase(Trim(tString)) End Function How to i call the function and how do i get the username i believe the username is in Returnusername? Alvin "Tom Ogilvy" skrev: http://www.erlandsendata.no/english/index.php?t=envbaos -- Regards, Tom Ogilvy "Jan G. Thorstensen" wrote in message ... Getting Computer name and User Name ----------------------------------------- Is it possible to get the name of the Computer using vba? (i.e. debug.print computerName) PS. How can you get the user name from the loged in user in a network (without using application.username)? What I want to know is who is the person using my program and which PC is he or she using. Thank you for helping. Jan |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Getting Computer name and User Name
Note that the environ approach won't work with Windows 95 / 98 / ME. Not
sure about OSX. Best wishes Harald "Bob Phillips" skrev i melding ... debug.print environ("computername") and debug.print environ("username") -- HTH RP (remove nothere from the email address if mailing direct) "Jan G. Thorstensen" wrote in message ... Getting Computer name and User Name ----------------------------------------- Is it possible to get the name of the Computer using vba? (i.e. debug.print computerName) PS. How can you get the user name from the loged in user in a network (without using application.username)? What I want to know is who is the person using my program and which PC is he or she using. Thank you for helping. Jan |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Formula only working for 1 user on 1 computer | Excel Discussion (Misc queries) | |||
User defined buttons in Toolbars,transfer to another computer | Excel Discussion (Misc queries) | |||
User Name / Computer Name | Excel Programming | |||
How can I ensure a message to the computer user is aknowledged? | Excel Programming | |||
_How could I get the code to find out the resolution that user has in the computer | Excel Programming |