'Windowsログイン名取得API Private Declare Function GetUserName Lib “ADVAPI32.dll" _ Alias “GetUserNameA" _ (ByVal lpBuffer As String, nSize As Long) As Long Sub test() Dim strBuffer As String Dim lngLngs As Long Dim lngRet As Long Dim Get_User As String ' ' Bufferを確保 strBuffer = String(256, Chr(0)) lngLngs = Len(strBuffer) ' ' ログインユーザー名取得 lngRet = GetUserName(strBuffer, lngLngs) Get_User = UCase(Left$(strBuffer, InStr(1, strBuffer, Chr(0)) – 1)) ' MsgBox Get_User ' End Sub