Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Loged On User Name

Thanks... Good to know... I actually have a module that I used to use but
gave up on it in favour of "Environ"... When I do any consulting i will be
sure to ue the API...
--
HTH...

Jim Thomlinson


"Chip Pearson" wrote:

Environ("UserName") is a whole pile easier and based on a long drawn out


True enough, but I've encountered situations in which an environment
variable is not returned when accessed by name. It works if you use the
number (but those numbers aren't the same across PCs and you have to split
apart the result), but not by name. I use the API version myself, but have
a wrapper function similar to Bob's in my standard library module, which is
imported into every project I work on.

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)

"Jim Thomlinson" wrote in message
...
Environ("UserName") is a whole pile easier and based on a long drawn out
discussion on the topic (posted some time back) there is really no great
advantage to using the API that you posted... That being said the code you
posted works just fine (I used to use it myself)...
--
HTH...

Jim Thomlinson


"Gary''s Student" wrote:

From Bob Phillips:

Public Declare Function GetUserName Lib "advapi32.dll" _
Alias "GetUserNameA" _
(ByVal lpBuffer As String, _
nSize As Long) As Long


Public Function UserName() As String
Dim sName As String * 256
Dim cChars As Long
cChars = 256
If GetUserName(sName, cChars) Then
UserName = Left$(sName, cChars - 1)
End If
End Function



--
Gary's Student


"jutlaux" wrote:

Is there a way to get the the user name of the current user who is
logged on
to a PC so that it can be inputted into a cell?




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
Defining user access (via user id) using macros maruko Excel Discussion (Misc queries) 0 July 27th 09 02:44 AM
How do I report to User A vs User B from shared data table? RogClark Excel Discussion (Misc queries) 0 April 30th 09 07:54 PM
How to: User Form to assign a user defined range to a macro variab TrevTrav Excel Programming 1 March 22nd 05 07:57 PM
User Defined Functions - Help Text - Make it Easy for the User Andibevan[_2_] Excel Programming 4 March 17th 05 09:51 AM
How to: Make user click End User License Agreement acceptance jasonsweeney[_21_] Excel Programming 7 January 30th 04 01:41 AM


All times are GMT +1. The time now is 06:46 PM.

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

About Us

"It's about Microsoft Excel"