本帖最后由 作者 于 2010-5-10 9:27:20 编辑
各位高手我有点事情想请教下,怎样在vba中用函数定义实现ip地址查询呢? 也就是说我知道一些IP,怎样来判断它是南通或者北京(这些ip就是是南通和北京的)? 怎么在vba里面实现啊!请指教我下。。。。 例子; Public Sub GetMyIP() Dim strComputer As String Dim objWMI As Object Dim colIP As Object Dim IP As Object Dim i As Integer strComputer = "." Set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colIP = objWMI.ExecQuery _ ("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE") For Each IP In colIP If Not IsNull(IP.IPAddress) Then For i = LBound(IP.IPAddress) To UBound(IP.IPAddress) MsgBox IP.IPAddress(i), vbInformation, IP.Description(i) Next End If Next End Sub 我只能查询本机的IP ,怎么才能实现查询访问的IP呢?并且进行对比。 |