Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Public Function TestPcName()
Dim lpBuffer As String, nDummy As Long, nSize As Long
nSize = 255
lpBuffer = Space$(nSize)
nDummy = GetComputerName(lpBuffer, nSize)
Debug.Print Left(lpBuffer, nSize)
End Function
You'll find loads of useful api calls on this website the above link points to the page for getting usernames.
If that isn't what you want then you maybe able to find what you want eslewhere on that site. Otherwise the following points to the page for getting the computername.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.