Hi Mark
Put first these declaration in a standard module :
Declare Function Get_User_Name Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, _
nSize As Long) As Long
Public Function GetUserName() As String
' By Chris Rae, 14/6/99, 3/9/00.
'Option Explicit
' This is used by GetUserName() to find the current user's
' name from the API
Dim lpBuff As String * 25
Get_User_Name lpBuff, 25
GetUserName = Left(lpBuff, InStr(lpBuff, Chr(0)) - 1)
End Function
Then, in a sub, you can test the user name
sub test
Dim strmsgUser$
user = GetUserName
if user= "username" then
end if
end sub
Regards,
Jean-Yves
"Pete JM " wrote in message
...
Hi, is it possible for excel to know who has loged on to the system and
then run a macro i have set up for that user?
I'm thinking of some form of IF statment macro but i have know idea of
how to get excel to know who has logged in.
We all have different logins for the computer for example pmawle or
tsmith etc..
Regards
Pete
---
Message posted from http://www.ExcelForum.com/