zoukankan      html  css  js  c++  java
  • Excel获取手机归属地自定义VB方法

    原文链接

    [Visual Basic] 纯文本查看 复制代码
    01
    02
    03
    04
    05
    06
    07
    08
    09
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    Public Function GetMobileLocation(pohoenumber As String)
         
        Dim Url As String
         
        Url = "http://cx.shouji.360.cn/phonearea.php?number=" + pohoenumber
         
        If pohoenumber <> "" Then
            
            Dim xml_http As Object
     
            Set xml_http = CreateObject("Microsoft.XMLHTTP")
     
            xml_http.Open "get", Url, True
     
            xml_http.sEnd
     
            Do Until xml_http.ReadyState = 4
     
                DoEvents
     
            Loop
             
            Dim bodyData
             
            bodyData = xml_http.responseText
                
            Dim lastData
             
            lastData = Replace(bodyData, "data", "objectdata")
     
            Set JSON = CreateObject("MSScriptControl.ScriptControl"): JSON.Language = "JScript"
             
            Set Obj = JSON.eval("eval(" & lastData & ")")
             
            GetMobileLocation = Array(Obj.objectdata.province, Obj.objectdata.sp)
             
            ' GetMobileLocation = Obj.objectdata.province
             
            Set xml_http = Nothing
     
        Else
            GetMobileLocation = Array("--", "--")
         
        End If
         
    End Function



    首先导入函数


    使用方法:选中两个单元格=GetMobileLocation(A1),然后ctrl+shift+enter

  • 相关阅读:
    PTA 7-6 列出连通集(深搜+广搜)
    TZOJ 2648 小希的迷宫(并查集)
    HDU 3342 Legal or Not(拓扑排序)
    哈夫曼树
    mst
    [THUWC2017]随机二分图
    视察
    [bzoj3274]Circle
    [bzoj3273]liars
    求导相关
  • 原文地址:https://www.cnblogs.com/jscs/p/13626982.html
Copyright © 2011-2022 走看看