Device ID Lookup through VBA

Falko26

Board Regular
Joined
Oct 13, 2021
Messages
89
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

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
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,214,388
Messages
6,119,229
Members
448,879
Latest member
VanGirl

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