You must declare it like this
Code:
Option Explicit

   
Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" _
    (ByVal lpBuffer As String, nSize As Long) As Long
This at the top of a form.