MAC address RRS feed

  • Question

  • I want to check MAC address from VBA Excel to restrict opening my file on systems I do not trust. Is this possible from VBA Excel?
    Wednesday, September 2, 2015 5:47 PM


  • Function MAC_ADDRESS() As String
      Dim cfg As Variant
      For Each cfg In GetObject("winmgmts://.").ExecQuery("SELECT * " _
          & "FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled=True")
        If Not IsNull(cfg.IPAddress) Then
          MAC_ADDRESS = cfg.MACAddress
          Exit For
        End If
    End Function

    Wednesday, September 2, 2015 5:59 PM