Sub wmiGetMac() Dim WmiObjSet, Obj Set WmiObjSet = GetObject("winmgmts:{impersonationLevel=impersonate}"). _ InstancesOf("Win32_NetworkAdapterConfiguration") On Local Error Resume Next For Each Obj In WmiObjSet MsgBox Obj.MACAddress MsgBox Obj.Description MsgBox Obj.DNSHostName MsgBox Obj.DNSDomain If Not IsNull(Obj.IPAddress) Then For i = 0 To UBound(Obj.IPAddress) MsgBox "IP address:" & Obj.IPAddress(i) Next End If Next End Sub
Dim WmiObjSet, Obj
Set WmiObjSet = GetObject("winmgmts:{impersonationLevel=impersonate}"). _
InstancesOf("Win32_NetworkAdapterConfiguration")
On Local Error Resume Next
For Each Obj In WmiObjSet
MsgBox Obj.MACAddress
MsgBox Obj.Description
MsgBox Obj.DNSHostName
MsgBox Obj.DNSDomain
If Not IsNull(Obj.IPAddress) Then
For i = 0 To UBound(Obj.IPAddress)
MsgBox "IP address:" & Obj.IPAddress(i)
Next
End If
Next
End Sub