Private Function GetMac() As String
Dim objWMIService As Object, objItem As Object, colItems As Variant
GetMac = ""
Set objWMIService = GetObject("winmgmts:\\.\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapter")
For Each objItem In colItems
'MsgBox Nz(objItem.Name, "") & " / " & Nz(objItem.MACAddress, "")
If InStr(objItem.Name, "etwork") <> 0 Then
If Not IsNull(objItem.MACAddress) Then
GetMac = objItem.MACAddress
' Label24.Caption = objItem.MACAddress
Exit For
End If
End If
Next
End Function