Solved

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

Posted on 1998-09-08
4
145 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
  • 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
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…

840 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