I'm looking for a function that shows the windows username of the first person who opened the book.
Looking online I found two VBA that got me close to what I wanted, but I haven't managed to combine them since I understand close to nothing of VBA code.
I have a name "OpenFirstTime" set to TRUE and this code
I also have this function that shows the CURRENT windows username
Again, I'm looking for a way to run the function on the first workbook open, save the result, and then, with another function, call that result.
Is that even possible?
Thanks!
Looking online I found two VBA that got me close to what I wanted, but I haven't managed to combine them since I understand close to nothing of VBA code.
I have a name "OpenFirstTime" set to TRUE and this code
VBA Code:
Private Sub Workbook_Open()
If Evaluate("OpenFirstTime") = True Then
'missing code
ThisWorkbook.Names("OpenFirstTime").Value = False
End If
End Sub
VBA Code:
Function UserName() As String
UserName = Environ("USERNAME")
End Function
Is that even possible?
Thanks!