Web Development

General discussion


VB API Call & Excel 2000

By Sheryl V ·
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)
GetUserName = ""
End If

End Function

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

by Sheryl V In reply to

Poster rated this answer.
thrid one worked, it was a variation on what I had, but it actaully works so thank you!

Collapse -

by Sheryl V In reply to VB API Call & Excel 2000

This question was closed by the author

Related Discussions

Related Forums