vbaenvironment-variablescomputer-name

How to get name of the computer in VBA?


Is there a way to get the name of the computer in VBA?


Solution

  • Dim sHostName As String
    
    ' Get Host Name / Get Computer Name
    
    sHostName = Environ$("computername")