Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA"
(ByVal lpBuffer As String, nSize As Long) As Long
Function ActiveUser() As String
Dim str As String
str = Space(256)
If GetUserName(str, 256) Then ActiveUser = Split(str, Chr(0), 2)(0)
End Function
--
Rob van Gelder -
http://www.vangelder.co.nz/excel
"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/