`

一段根据IP 地址获取所在国家地区的VBS

 
阅读更多
'
' 根据IP地址获取所在国家地址及运营商
'
'
Sub GetIPArea()
    Dim s As String, m
    Dim ipCol, areaCol As Integer  '定义Excel表中IP所在列号、将要填写国家地区的列号
    
    ipCol = 2
    areaCol = 3
    
    With CreateObject("msxml2.xmlhttp")
        For m = 2 To [b65536].End(xlUp).Row
            DoEvents
              .Open "GET", "http://www.ip138.com/ips138.asp?ip=" & Cells(m, ipCol) & "&action=2", False
              .send
            s = StrConv(.responsebody, vbUnicode)
            Cells(m, areaCol) = Split(Split(s, "本站数据:")(1), "</li>")(0)
            Cells(m, areaCol + 1) = Split(Split(s, "参考数据1:")(1), "</li>")(0)
        Next
    End With
End Sub

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics