Saturday, July 15, 2017

Get IP and MAC addres

Get IP and MAC addres


Private Sub Form_Load()

    Dim myWMI As Object, myObj As Object, Itm
    
    Set myWMI = GetObject("winmgmts:\\.\root\cimv2")
    Set myObj = myWMI.ExecQuery("SELECT * FROM " & _
                     "Win32_NetworkAdapterConfiguration " & _
                     "WHERE IPEnabled = True")
    For Each Itm In myObj
        MsgBox (Itm.IPAddress(0))
        MsgBox (Itm.MACAddress)
        Exit For
    Next

End Sub





Source: VBForums

No comments:

Post a Comment