Code:
Private Declare Function GetComputerNameW Lib "kernel32.dll" (ByVal lpBuffer As Long, ByRef lpnSize As Long) As Long
Public Function GetComputerName() As String
Const MAX_COMPUTERNAME_LENGTH = 31&
Dim nSize As Long, sBuffer As String
nSize = MAX_COMPUTERNAME_LENGTH
sBuffer = Space$(nSize)
If GetComputerNameW(StrPtr(sBuffer), nSize) Then GetComputerName = Left$(sBuffer, nSize)
End Function
Don't forget to mark this thread
Resolved if you're done!