ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Office XP compatiblity- Signed in user (https://www.excelbanter.com/excel-programming/355637-office-xp-compatiblity-signed-user.html)

scubaguy_357

Office XP compatiblity- Signed in user
 
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.


All times are GMT +1. The time now is 12:35 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com