Skip to content

Instantly share code, notes, and snippets.

@fareedfauzi
Created January 3, 2021 03:56
Show Gist options
  • Save fareedfauzi/2ab348a12caebcf47ec37e507d1fbb60 to your computer and use it in GitHub Desktop.
Save fareedfauzi/2ab348a12caebcf47ec37e507d1fbb60 to your computer and use it in GitHub Desktop.
'Blogpost: notes.netbytesec.com
Private Sub Document_Open()
Dim i As Integer
Dim str As String
i = 0
Set WMI = GetObject("WinMgmts:")
For Each obj In WMI.InstancesOf("Win32_PhysicalMedia")
If obj.SerialNumber <> "" Then i = i + 1
Next
If i = 0 Then
Exit Sub
End If
st
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment