ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Log UserID (https://www.excelbanter.com/excel-programming/324891-log-userid.html)

JJ

Log UserID
 
How do I automatically store the NTUser's logonId to an excel file once it is
opened?

I have an excel file that pulls records from a database. Since multiple
users can access the database at the same time, I would like to flag a record
once it is retrieved. I got the flag part down but would also like to update
the record with userId to track what user retrieved what records. How do I
pull the NTUserID and store it in the spreadsheet? Everytime the excel file
is opened, I would like to store the NTUser ID in a cell so I can pull that
value and store it into the database. I just need to know how I can get the
logonId stored to the cell. Any ideas? Thanks.

Jim Thomlinson[_3_]

Log UserID
 
try this

MsgBox Environ("UserName")

It returns the NT username.

HTH

"JJ" wrote:

How do I automatically store the NTUser's logonId to an excel file once it is
opened?

I have an excel file that pulls records from a database. Since multiple
users can access the database at the same time, I would like to flag a record
once it is retrieved. I got the flag part down but would also like to update
the record with userId to track what user retrieved what records. How do I
pull the NTUserID and store it in the spreadsheet? Everytime the excel file
is opened, I would like to store the NTUser ID in a cell so I can pull that
value and store it into the database. I just need to know how I can get the
logonId stored to the cell. Any ideas? Thanks.


Jim Thomlinson[_3_]

Log UserID
 
Sorry I assumed that you know how to place that in a cell (which is probably
the case but jut to be thourough)

sheet1.range("A1").value = environ("UserName")

HTH

"Jim Thomlinson" wrote:

try this

MsgBox Environ("UserName")

It returns the NT username.

HTH

"JJ" wrote:

How do I automatically store the NTUser's logonId to an excel file once it is
opened?

I have an excel file that pulls records from a database. Since multiple
users can access the database at the same time, I would like to flag a record
once it is retrieved. I got the flag part down but would also like to update
the record with userId to track what user retrieved what records. How do I
pull the NTUserID and store it in the spreadsheet? Everytime the excel file
is opened, I would like to store the NTUser ID in a cell so I can pull that
value and store it into the database. I just need to know how I can get the
logonId stored to the cell. Any ideas? Thanks.


Tom Ogilvy

Log UserID
 
See mr Erlandsen's page
http://www.erlandsendata.no/english/...nvbaosusername
or Chris Rae's page http://www.chrisrae.com/vba/routines.html

--
Regards,
Tom Ogilvy

"JJ" wrote in message
...
How do I automatically store the NTUser's logonId to an excel file once it

is
opened?

I have an excel file that pulls records from a database. Since multiple
users can access the database at the same time, I would like to flag a

record
once it is retrieved. I got the flag part down but would also like to

update
the record with userId to track what user retrieved what records. How do

I
pull the NTUserID and store it in the spreadsheet? Everytime the excel

file
is opened, I would like to store the NTUser ID in a cell so I can pull

that
value and store it into the database. I just need to know how I can get

the
logonId stored to the cell. Any ideas? Thanks.





All times are GMT +1. The time now is 09:13 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com