I have an Excel form that uses the code below to get the logged on user's ID.
What is this line of the code doing? Is it subtracting a character where it reads "-1"? Is it removing a character?
What is this line of the code doing? Is it subtracting a character where it reads "-1"? Is it removing a character?
Code:
Private Sub Workbook_Open()
Dim lpBuff As String * 25
ret = GetUserName(lpBuff, 25)
logonUser = Left(lpBuff, InStr(lpBuff, Chr(0)) - 1)
ThisWorkbook.Names("CurrUsername").RefersTo = "=" & logonUser
ThisWorkbook.Names("CurrUserAlias").RefersTo = "=" & logonUser