I have the following code in VBA Excel. The "GetUserName" statement returns the "Can't find project or library" error.
This code runs well on several machines here. I only have a problem with the newest machine. I hope that all I need to do is find the appropriate library and reference it. if anyone could tell me which library that is I would be greatful.
In case it becomes an issue the new machine is the only machine running Windows Vista.
An alternate method to do the same thing would also help me out.
Thanks
This code runs well on several machines here. I only have a problem with the newest machine. I hope that all I need to do is find the appropriate library and reference it. if anyone could tell me which library that is I would be greatful.
Code:
Public Function NameOfUser() As String
' Returns the name of the logged-in user
Dim Buffer As String * 100
Dim BuffLen As Long
BuffLen = 100
GetUserName Buffer, BuffLen
NameOfUser = Left(Buffer, BuffLen - 1)
End Function
In case it becomes an issue the new machine is the only machine running Windows Vista.
An alternate method to do the same thing would also help me out.
Thanks