Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Login Information

Hi,
How can we get the user login information into a excel sheet.

If anyone opens a excel sheet stored in a server whenever the user opens it,
a cell should display the user login name??

Can anyone help me on that.
Thanks

Arvind.



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Login Information

Arvind,

Here is a simple function that returns the network user id

Here is a function to do it

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

Public Function UserName() As String
Dim sName As String * 256
Dim cChars As Long
cChars = 256
If GetUserName(sName, cChars) Then
UserName = Left$(sName, cChars - 1)
End If
End Function

The cell could then use

=UserName()

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Arvind P Rangan" wrote in message
...
Hi,
How can we get the user login information into a excel sheet.

If anyone opens a excel sheet stored in a server whenever the user opens

it,
a cell should display the user login name??

Can anyone help me on that.
Thanks

Arvind.





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Login Information

Hi,
Thanks but how do i use the function and should i need to put the vb
code in the xls file.

WHERE TO put the code and how to access it.

Thanks
ARvind.



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Login Information

Arvind,

just put it in a standard code module, and you can use

=UserName()

in a worksheet cell.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Arvind Rangan" wrote in message
...
Hi,
Thanks but how do i use the function and should i need to put the vb
code in the xls file.

WHERE TO put the code and how to access it.

Thanks
ARvind.



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



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
Login Name and now function saran Excel Worksheet Functions 3 August 18th 08 01:11 PM
Login Help!!! TMO[_6_] Excel Programming 1 February 8th 04 03:09 PM
Login ID over a network Patrick[_5_] Excel Programming 2 November 14th 03 11:55 AM
Login Box help Bill Lunney Excel Programming 0 August 20th 03 11:45 AM
Login Box Tom Ogilvy Excel Programming 0 August 8th 03 01:42 PM


All times are GMT +1. The time now is 10:22 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"