Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Option Compare Database
Option Explicit
Public Declare Function WNetGetUser Lib "mpr.dll" Alias "WNetGetUserA" (ByVal lpName As String, ByVal lpUserName As String, lpnLength As Long) As Long 'i.e. strUserNetworkName = MMC_WNetGetUser "", strUser, 255
Public Declare Function GetComputerName Lib "kernel32.dll" Alias "GetComputerNameA" (ByVal buffer As String, ByRef nsize As Long) As Boolean
Function GetUserNameComputerName()
Const MAXCHAR As Integer = 50 'Max. no. of chars. in computer name
Dim strHost As String 'Name of computer returned by function
Dim strUserName As String 'Network Name of User
'*****************************
'* Get User's Network Name *
'*****************************
strUserName = Space(255)
WNetGetUser "", strUserName, 255
Debug.Print Trim(strUserName)
'******************************
'* Get User's Computer Name *
'******************************
strHost = String(MAXCHAR, 0)
GetComputerName strHost, MAXCHAR
Debug.Print Trim(strHost)
End Function