Office XP compatiblity- Signed in user

S

scubaguy_357

The following function worked fine in my previous version of Excel but does
not work in XP. It tries to retrieve the logged in user. Thanks for the help!

Private Declare Function GetUserName Lib "advapi32.dll"_
Alias "GetUserNameA" (ByVal lpBuffer As String, nSize as Long)_
As Long

Funtion UserName() As String
Dim Buffer as String * 100
Dim BuffLen as Long
BuffLen=100
GetUserName Buffer, BuffLen
UserName= Left(Buffer, BuffLen - 1)
End Function
'The error I get is "Compile error- can't find project or library"

Thanks for any help you can give.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top