Solved

Knowing my UserId in NT3.51, and VBA (Excel 5.0)

Posted on 1998-09-08
4
148 Views
Last Modified: 2010-04-30
Is there any API in Windows NT 3.51 I could use with VB for Applocations (Excel 5.0), that let me know my User Id (and much better other data from the user, like my user name)?
If there exists (I'm sure there must exist), please write an example of use, or be as detailed as possible, as I am not experienced with Windows APIs
0
Comment
Question by:mquiles
[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
  • 3
4 Comments
 
LVL 14

Accepted Solution

by:
waty earned 100 total points
ID: 1433569
Here are funtion you can use :

' *** Get computer and user information
Private Declare Function GetComputerNameA Lib "kernel32" (ByVal lpBuffer As String, nSize As Long) As Long
Private Declare Function GetUserNameA Lib "advapi32.dll" (ByVal lpBuffer As String, nSize As Long) As Long


Public Function GetUserName() As String
   ' *** Get the user name
   
   Dim UserName         As String * 255

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

End Function

Public Function GetComputerName() As String
   ' *** Get the computer name
   
   Dim UserName         As String * 255

   Call GetComputerNameA(UserName, 255)
   GetComputerName = Left$(UserName, InStr(UserName, Chr$(0)) - 1)

End Function

0
 
LVL 14

Expert Comment

by:waty
ID: 1433570
You can go on my web site, you will find more source file for you to do what you want.

see my profile for web site
0
 

Author Comment

by:mquiles
ID: 1433571
Thanks a lot, it's very helpful for me, and works perfectly, as I wanted.
0
 
LVL 14

Expert Comment

by:waty
ID: 1433572
Don't hesitate to post me other questions
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

691 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