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

  • 相关阅读:
    js-实现点击按钮直接打印
    XMLHTTPREQUEST–获取上传文件的进度
    The prop 'history' is marked as required in 'Router', but its value is 'undefined'.in Router
    javascript之闭包,递归,深拷贝
    node之get与post
    css公共样式
    php之创建jsonp接口调数据
    javascript之创建对象的方式
    angular之两种路由
    php之上传图片及传数据到mysql
  • 原文地址:https://www.cnblogs.com/jscs/p/13626982.html
Copyright © 2011-2022 走看看