View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
sparx
 
Posts: n/a
Default Display in cell not dialogue box


Hello All - how do I make the result of the following macro display its
result in an excel cell not the dialogue box?

Sub GetPhysAddress()
Dim oWMIService As Object
Dim oColAdapters As Object
Dim oObjAdapter As Object

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

For Each oObjAdapter In oColAdapters
MsgBox "Adapter Physical address: " & oObjAdapter.MACAddress
Next

Set oObjAdapter = Nothing
Set oColAdapters = Nothing
Set oWMIService = Nothing
End Sub


--
sparx
------------------------------------------------------------------------
sparx's Profile: http://www.excelforum.com/member.php...o&userid=16787
View this thread: http://www.excelforum.com/showthread...hreadid=524275