①VBA获取主板信息
Dim objs As Object, Obj As Object, WMI As Object, 主板序列号
Set WMI = GetObject("WinMgmts:")
Set objs = WMI.InstancesOf("Win32_BaseBoard")
For Each Obj In objs
MsgBox "您的主板序列号是:" + Obj.SerialNumber
Next
②VBA获取硬盘信息
Dim 硬盘
Set 硬盘 = GetObject("Winmgmts:").InstancesOf("Win32_DiskDrive")
For Each mo In 硬盘
MsgBox "硬盘型号为:" & mo.Model
Next
③VBA获取CPU信息
For Each 序列 In GetObject("Winmgmts:").InstancesOf("Win32_Processor")
MsgBox "CPU 序列号: " & CStr(序列.ProcessorId)
Next