Solved

Login Name

Posted on 2002-04-29
2
168 Views
Last Modified: 2010-05-02
Hi All,
I was wondering what would be the best way to get the NT login names for users if I know there first name and last name. I was thinking about using ADSI. Is this a good solution.
Thank You,
Kent
0
Comment
Question by:kmurphy7
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 

Accepted Solution

by:
iski2 earned 50 total points
ID: 6978268
Try using:

Dim uLst
Set uLst = GetObject("WinNT://DomainName")
uLst.Filter = Array("User")
For Each User In uLst
List1.AddItem User.fullname
Next
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 6978279
Here is the code we use to get the user's login name

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


Public Function GetUserName() As String
Dim UserName As String * 255

Call GetUserNameA(UserName, 255)
GetUserName = Left$(UserName, InStr(UserName, Chr$(0)) - 1)
End Function

mlmcc
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
using web browser with BING 40 145
Visual Studio 2005 text editor 10 54
MsgBox 4 75
VBA: copy range dynamically based on config sheet v2 3 59
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

731 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question