Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

EXCEL question 3

Status
Not open for further replies.

wuwang

Programmer
May 16, 2001
48
US
Hello,

I grab data from EXCEL and write to a text file.
I want to put the log_in ID as part of the text file name
(user DOESN'T NEED to provide his log_in ID when he uses EXCEL application).

How to "memorize" the log_in ID and grab it to the text file name? (I was told to use security API function)
Could you give me a code example?

Very appreciate your help.

 
Wuwang,

I feel I can BEST help you by offering the following information and observations:

1) In designing the Tek-Tips forum, the creators built in a method of "properly" recognizing the contributions made by those experts who take the time to help others.

This method involves "issuing a STAR", which is done by simply clicking on the "Click here to mark this post as a helpful or expert post!". It is located in the lower-left-corner of the contributor's posting.

2) Many contributors take time out of their busy schedules to help others. They are doing so partly for the "challenge", but like almost ALL people, these contributors appreciate being properly "recognized". In Tek-Tips, the "proper" method of recognition, as set up its creators, is to ISSUE A "STAR".

3) The number of contributors and the number of STARS issued in the "Microsoft Office" forum is significantly GREATER than in this forum (VBA Visual Basic for Applications).

4) Perhaps the number of potential contributors to THIS forum have "quietly slipped away". In other words, when they find out that the recipients of their hard work often DO NOT show "proper" recognition, they decide "why waste my time" if the recipient won't even take the time to "ISSUE A STAR".

5) Wuwang, you have posted 26 questions, and yet have issued NO STARS. I hope this has been because you were simply “unaware” of this proper method of recognition, and now that you are aware, you will begin to issue STARS.

In fact, if you were to “announce” in this posting that you are NOW aware of this practice, and will begin to issue STARS, then I am certain that your future postings will receive much more attention from potential contributors.

In summation, perhaps look at the situation “this way”... Do you appreciate receiving your paycheck ? Certainly you do, and I expect you receive it for a “job well done”. Well, in this forum the “STARS” are the “equivalent” to receiving payment for a job well done, and it’s the contributors’ ONLY method of payment.

PLEASE be sure NOT to issue a STAR for this “reminder”. I prefer to earn STARS the normal way.

Regards, ...Dale Watson

WORK: dwatson@bsi.gov.mb.ca
HOME: nd.watson@shaw.ca
 
Try the following API declaration (Should be placed at the top of your module) and Function

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

Function GetUser() As String
Dim lpBuff As String * 255
Dim ret As Long, UserName As String
ret = GetUserName(lpBuff, 255)
GetUser = Left(lpBuff, InStr(lpBuff, Chr(0)) - 1)
End Function

You can then use LoginId = GetUser()

AC
 
Is this too easy dor this situation?....



If you need vb for apps to return the User ID of the person logged on to the pc running an Office application,, this will do it.


Sub get_userID()
x$ = Environ("UserName")
MsgBox (x$)
End Sub
 
Hi Dale Watson,

I should apology to you and other peoples who has been helping me a lot for my 'improper' reacting. Believe me,
I DO APPRECIATE the help from you all.

Now I know how to issue a STAR. Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top