My task has been to create a secure (Windows version) Excel workbook that uses macros to validate whether a user has permission to view the contents. In Excel 2010 for Windo
You can use AppleScript to return the Username and run that from VBA.
The following function should do the trick.
Function GetUserNameMac() As String
Dim sMyScript As String
sMyScript = "set userName to short user name of (system info)" & vbNewLine & "return userName"
GetUserNameMac = MacScript(sMyScript)
End Function
Environ("USER")
and Environ("LOGNAME")
return the same thing on the Mac as the MacScript answer.