multiple network cards one mac address

jasn_78

Registered User.
Local time
Tomorrow, 01:16
Joined
Aug 1, 2001
Messages
214
hey guys its been along day on some very new stuff for me so sorry bout all these posts with the following code i am obtaining the network cards mac address and returning just the numeric value out of this now this works great until i have more than one network card enable and i get an overflow error any ideas to fix this problem besides obviously disabling all but one card would be great

Code:
Dim oWMIService As Object
Dim oColAdapters As Object
Dim oObjAdapter As Object
Dim Mac
Dim i As Integer
Dim x As Long


Set oWMIService = GetObject("winmgmts:" & "!\\.\root\cimv2")
Set oColAdapters = oWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled = True")

For Each oObjAdapter In oColAdapters
'Me.txtSERIAL = oObjAdapter.MACAddress
Mac = oObjAdapter.MACAddress
For i = 1 To Len(Mac)
    
    If IsNumeric(Mid(Mac, i, 1)) Then
      x = x & Mid(Mac, i, 1)
    End If
    
  
  Next i


Next

Me.txtSERIAL = CLng(x)



Set oObjAdapter = Nothing
Set oColAdapters = Nothing
Set oWMIService = Nothing
 

Users who are viewing this thread

Back
Top Bottom