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

  • 相关阅读:
    74. Search a 2D Matrix(js)
    73. Set Matrix Zeroes(js)
    72. Edit Distance(js)
    71. Simplify Path(js)
    兼容各种浏览器版本的事件绑定函数?
    浏览器兼容性问题
    柯里化函数
    token登录验证机制
    vue懒加载
    在Vue中使用了Swiper ,动态从后台获取数据的之后,swiper滑动失效??
  • 原文地址:https://www.cnblogs.com/jscs/p/13626982.html
Copyright © 2011-2022 走看看