How to get name of the computer in VBA?

Alex Gordon picture Alex Gordon · Aug 23, 2010 · Viewed 127.9k times · Source

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

Answer

Tommy picture Tommy · Aug 23, 2010
Dim sHostName As String

' Get Host Name / Get Computer Name

sHostName = Environ$("computername")