Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default find mac address of my own computer by excell macro

I am using excell 2002. I want to find mac address of my own computer by
excell macro.
  #2   Report Post  
Posted to microsoft.public.excel.programming
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.


  #3   Report Post  
Junior Member
 
Posts: 1
Default

Steve

the below formula is great but is it possable to enter the MAC address in to a cell (eg A1 Sheet1) instead of a message box

regards

chris


Quote:
Originally Posted by Steve Yandl[_3_] View Post
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.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
(Excel 2007) API to get computer IP address or domain name? rick Excel Programming 1 August 4th 09 08:01 PM
using filer command in excell it locks up my computer Larry King Excel Worksheet Functions 0 June 30th 06 03:18 AM
Excel /vba / computer IP address jolipe Excel Discussion (Misc queries) 1 June 3rd 05 10:55 PM
Excel /vba / computer IP address jolipe Excel Programming 1 June 3rd 05 07:50 PM
Excel /vba / computer IP address jolipe[_2_] Excel Programming 0 June 3rd 05 07:01 PM


All times are GMT +1. The time now is 04:17 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"