7,765
社区成员
发帖
与我相关
我的任务
分享
Option Explicit
Private Sub Command1_Click()
Text1.Text = Replace(MACAddress, ":", "-")
End Sub
Private Function MACAddress() As String
Dim objs As Object, obj As Object
Set objs = GetObject("winmgmts:").ExecQuery("SELECT MACAddress " & "FROM Win32_NetworkAdapter " & "WHERE " & "((MACAddress Is Not NULL) " & "AND (Manufacturer <> " & "'Microsoft'))")
For Each obj In objs
MACAddress = obj.MACAddress
Exit For
Next obj
End Function