+1  A: 

There is no TOP 1 clause in WQL. Leave it out and your query should work:

"SELECT * FROM Win32_Process WHERE Name = 'EXCEL.EXE'"
Uros Calakovic
What if someone else is logged into the box on another account? Does this strategy fall apart? Could it pick up the Excel that the other user might be running and return the incorrect info? btw, removing the TOP 1 worked.
tyndall
Yes it does. In case of multiple Excel.exe instances started by different users, the function would return uname and udomain for the last objProcess enumerated, which would not necessarily be the instance that called it. It would be easy if Excell.Application had a property for ProcessId...
Uros Calakovic
+1  A: 

How about

UserName = Environ("Username")
Domain = Environ("UserDomain")
Combined= Environ("UserDomain") & "\" & Environ("Username")
dbb
Note that Environ is an "unsafe expression" in sandbox mode: http://office.microsoft.com/en-us/access/HA012301901033.aspx?pid=CH100621891033
Remou
Also, people can change their environment variables right?
tyndall