Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get name of the computer in VBA?

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

like image 725
Alex Gordon Avatar asked Aug 23 '10 19:08

Alex Gordon


People also ask

How do I find the computer name in Excel?

We have created “GetComputerUserName” macro to find the computer and user name. We can run the macro by clicking “Submit” button. Macro will extract computer name in cell C10 and user name in cell C11. Environ function returns the string value associated with environment variable of the operating system.

How do you find a computer's name?

Click on the Start button. In the search box, type Computer. Right click on This PC within the search results and select Properties. Under Computer name, domain, and workgroup settings you will find the computer name listed.

How do I get system information in Excel VBA?

Excel has the same OperatingSystem object but under the Application class, so to get the same info in Excel you use Application. OperatingSystem . A full reference of the objects available to you is provided in the Object Browser (F2 from within the VBA editor.)


1 Answers

Dim sHostName As String  ' Get Host Name / Get Computer Name  sHostName = Environ$("computername") 
like image 120
Tommy Avatar answered Sep 27 '22 23:09

Tommy