VB API Call & Excel 2000 - TechRepublic
General discussion
December 11, 2003 at 12:53 PM
sheryl v

VB API Call & Excel 2000

by sheryl v . Updated 22 years, 7 months ago

How can I make this API call & function that DOES work in MSAccess 2000 on Win2000 work in Excel2000, same platform?

Declare Function DeclareGetLogin Lib “advapi32.dll” Alias “GetUserNameA” (ByVal lpBuffer As String, nSize As Long) As Long

Function GetUserName() As String
Dim lngLen As Long
Dim strBuf As String

strBuf = Space(255)
lngLen = 255
If CBool(DeclareGetLogin(strBuf, lngLen)) Then
GetUserName = Left$(strBuf, lngLen – 1)
Else
GetUserName = “”
End If

End Function

This discussion is locked

All Comments