• 设为首页
  • 收藏本站
  • 积分充值
  • VIP赞助
  • 手机版
  • 微博
  • 微信
    微信公众号 添加方式:
    1:搜索微信号(888888
    2:扫描左侧二维码
  • 快捷导航
    福建二哥 门户 查看主题

    使用vbs获取雅虎汇率

    发布者: 福建二哥 | 发布时间: 2025-8-13 23:02| 查看数: 48| 评论数: 0|帖子模式

    使用vbs获取雅虎汇率
    1. Function bytes2bstr(vin)
    2.   strreturn = ""
    3.   for i = 1 to lenb(vin)
    4.     thischarcode = ascb(midb(vin,i,1))
    5.     if thischarcode < &h80 then
    6.       strreturn = strreturn & chr(thischarcode)
    7.     else
    8.       nextcharcode = ascb(midb(vin,i+1,1))
    9.       strreturn = strreturn & chr(clng(thischarcode) * &h100 + cint(nextcharcode))
    10.       i = i + 1
    11.     end if
    12.   next
    13.   bytes2bstr = strreturn
    14. End Function
    15. Function GetURL(url)
    16.   Set Retrieval = CreateObject("Microsoft.XMLHTTP")
    17.   With Retrieval
    18.     .Open "GET", url, False
    19.     .Send
    20.     GetURL = bytes2bstr(.responsebody)
    21.     if len(.responsebody)<2 then
    22.       strContent = "远程通讯故障!"
    23.       Call LogToFile(strContent,1)
    24.     response.end
    25.     end if
    26.   End With
    27.   Set Retrieval = Nothing
    28. End Function
    29. '========以上为自定义函数========

    30. s1 = INPUTBOX("原始货币代码:","请输入原始货币代码","USD")
    31. s2 = INPUTBOX("目标货币代码:","请输入目标货币代码","CNY")
    32. s = s1&s2
    33. url = "http://download.finance.yahoo.com/d/quotes.csv?e=.csv&f=sl1d1t1&s="&s&"=x"
    34. if s1<>"" and s2<>"" Then
    35.   huilv = GetURL(url)
    36.   MsgBox huilv
    37. End if
    复制代码

    来源:互联网
    免责声明:如果侵犯了您的权益,请联系站长(1277306191@qq.com),我们会及时删除侵权内容,谢谢合作!

    最新评论

    浏览过的版块

    QQ Archiver 手机版 小黑屋 福建二哥 ( 闽ICP备2022004717号|闽公网安备35052402000345号 )

    Powered by Discuz! X3.5 © 2001-2023

    快速回复 返回顶部 返回列表