>>642
読みにくいのは勘弁な

--- 標準モジュールに
Option Explicit

'ユーザ名を取得する
Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" ( _
ByVal lpBuffer As String, _
nSize As Long _
) As Long

'コンピュータ名を取得する
Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" ( _
ByVal lpBuffer As String, _
nSize As Long _
) As Long
--- 標準モジュール ここまで
とやって
コマンドボタン1個とテキストボックス2個貼ったフォームを用意。

--- テスト用フォーム

Private Sub Command1_Click()

Dim lngRetAPI As Long
Dim tempX As String

tempX = String(256, Chr(0))

'ユーザ名(GetUserName)
lngRetAPI = GetUserName(tempX, 256)
Text1.Text = Left$(tempX, InStr(1, tempX, Chr(0)) - 1)

'コンピュータ名(GetComputerName)
lngRetAPI = GetComputerName(tempX, 255)
Text2.Text = Left$(tempX, InStr(1, tempX, Chr(0)) - 1)

End Sub

--- テスト用フォーム ここまで

で、ボタンを押す。