none
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

Answers

  • Function MAC_ADDRESS() As String
      Dim cfg As Variant
      'http://msdn.microsoft.com/en-us/library/aa394585%28v=vs.85%29.aspx
      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
      Next
    End Function

    Wednesday, September 2, 2015 5:59 PM