#1   Report Post  
Posted to microsoft.public.excel.programming
JJ JJ is offline
external usenet poster
 
Posts: 122
Default 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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default 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.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default 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.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I track changes made to a shared file per userid. Julie _at_GBS Excel Discussion (Misc queries) 4 May 3rd 05 01:52 PM
Script a userid and password (apache) Steph[_3_] Excel Programming 0 November 23rd 04 10:34 PM
DSN UserId and Password Prompt bslater[_13_] Excel Programming 0 September 22nd 04 09:02 PM
DSN UserId and Password Prompt bslater[_12_] Excel Programming 1 September 22nd 04 08:30 PM
FileSystemObject CopyFile with UserID/Password Tod[_3_] Excel Programming 0 January 7th 04 06:03 PM


All times are GMT +1. The time now is 05:54 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"