Skip to main content

How to get computer name in VBA?

 Computer name shall be in capital letters only. So when you want to use computer name in VBA. follow the method mentioned below 

1. Go to my computer

2. Right click

3. Click on properties. 

4. You can see the computer name. 

5. Copy the name and paste it to word processor

6. Capitalize the name

7. copy it and use in VBA. 


Method 2:

1. In VBA type - msgbox Environ$("computername")

2. Debug by pressing F8

3. when you will cross above mentioned command line, Excel will popup the computer name. 

4. use the same name in VBA. 


Thats all. 

Comments