Device ID Lookup through VBA

Falko26

Board Regular
Joined
Oct 13, 2021
Messages
99
Office Version
  1. 365
Platform
  1. Windows
Hey Team,

Device ID is not one of the Environ Variables Excel can access.

Does anyone know how to lookup the Device ID of the computer you are currently working on using Excel VBA?
I can find this variable myself by going to the about section in settings. however I am looking to reference this number for security purposes of my spreadsheet.

Thanks,
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Don't know about the Device ID, but the computer name is relatively simple.
VBA Code:
Sub GetName()
    MsgBox Environ$("computername")
End Sub
 
Upvote 0
D
Hey Team,

Device ID is not one of the Environ Variables Excel can access.

Does anyone know how to lookup the Device ID of the computer you are currently working on using Excel VBA?
I can find this variable myself by going to the about section in settings. however I am looking to reference this number for security purposes of my spreadsheet.

Thanks,
Did you mean this "Device ID"?

1683162026139.png

VBA Code:
Private Sub GetDeviceId()
    Dim objShell As Object
    Set objShell = CreateObject("WScript.Shell")
    Debug.Print objShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SQMClient\MachineId")
End Sub

1683162322546.png
 
Upvote 0
Solution

Forum statistics

Threads
1,224,817
Messages
6,181,149
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top