Got to say, instead of messing around with API for finding logged in windows user name, simply use this short code. So simple my grandma could use it.
Couldn't get much simpler. Also many other things which can be extracted from the ENVIRON command. Here they are.
Code to View All Available ENVIRON info
Sub ENVIRON_DUMP() Dim nCount As Integer nCount = 1 Do Until Environ(nCount) = "" Cells(nCount, 1).Value = Environ(nCount) nCount = nCount + 1 Loop End Sub