标题:VBA讀網卡MAC
只看楼主
w327555162
Rank: 2
等 级:论坛游民
帖 子:45
专家分:43
注 册:2011-1-4
结帖率:85.71%
 问题点数:0 回复次数:0 
VBA讀網卡MAC
Dim Str$, Arr, N&, i&, FN$
Dim k
FN = ThisWorkbook.Path & "\IpInfo.txt"
With CreateObject("wscript.shell")
    .Run Environ("comspec") & " /c ipconfig /all>""" & FN & """", 0, 1
End With
With CreateObject("scripting.filesystemobject").opentextfile(FN)
    Str = .readall
    .Close
End With
Kill FN
Arr = Split(Str, vbNewLine)
For i = LBound(Arr) To UBound(Arr)
    If LCase(Arr(i)) Like "*physical address*:*" Then
        k = Trim(Split(Arr(i), ":")(1))
     k = Mid(k, 1, 2) & Mid(k, 4, 2) & Mid(k, 7, 2) & Mid(k, 10, 2) & Mid(k, 13, 2) & Mid(k, 16, 2)
    End If
Next i
這段代碼在XP下是沒有問題的,能讀到外接的網卡,但在WIN7下就不行了,求指正
搜索更多相关主题的帖子: physical address 
2011-12-01 10:34



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-356677-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.492308 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved