Tested in Excel 365 (16.8730.2046) 64-bit
- Public Function GetUserName()
- Dim objNet
- Set objNet = CreateObject("WScript.NetWork")
- GetUserName = objNet.UserName
- Set objNet = Nothing
- End Function
Or the simpler way:
- myName = environ("username")
Tested in Excel 365 (16.8730.2046) 64-bit
Or the simpler way: