View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Steve Yandl[_3_] Steve Yandl[_3_] is offline
external usenet poster
 
Posts: 117
Default find mac address of my own computer by excell macro

Give something like this a try.

'----------------------------------
Sub GetMAC()

Dim strLine As String
Dim bEther As Boolean

bEther = False
Set wsh = CreateObject("WScript.Shell")
Set wshExec = wsh.Exec("ipconfig /all")
Set objStdOut = wshExec.StdOut

Do Until objStdOut.AtEndOfStream
strLine = objStdOut.ReadLine
If InStr(strLine, "Ethernet") 0 Then
bEther = True
End If

If InStr(strLine, "Physical Address") 0 And bEther Then
strLine = Right(strLine, 17)
Exit Do
End If
Loop

MsgBox strLine

Set wshExec = Nothing
Set wsh = Nothing
End Sub

'----------------------------------

Steve Yandl


"INQUISITIVE DISCIPLE" <INQUISITIVE
wrote in message ...
I am using excell 2002. I want to find mac address of my own computer by
excell macro.