Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 209
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 209
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Formula only working for 1 user on 1 computer shebe Excel Discussion (Misc queries) 3 February 29th 08 06:01 PM
User defined buttons in Toolbars,transfer to another computer marko Excel Discussion (Misc queries) 2 December 13th 05 07:22 PM
User Name / Computer Name David Hall[_2_] Excel Programming 3 May 28th 04 12:07 PM
How can I ensure a message to the computer user is aknowledged? Gary Ainsworth Excel Programming 1 November 17th 03 10:37 AM
_How could I get the code to find out the resolution that user has in the computer U. Kõrsmaa Excel Programming 2 July 17th 03 10:00 AM


All times are GMT +1. The time now is 05:39 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"