Use VBS to get Yahoo exchange rate _vbs

Source: Internet
Author: User
Tags chr

Get Yahoo exchange rate using VBS

Function Bytes2bstr (vin) Strreturn = "" For i = 1 to LenB (vin) Thischarcode = ASCB (MidB (vin,i,1)) if Thischar Code < &AMP;H80 Then Strreturn = strreturn & Chr (thischarcode) Else Nextcharcode = ASCB (MidB (vin,i+ 1,1)) Strreturn = Strreturn & Chr (CLng (thischarcode) * &h100 + CInt (nextcharcode)) i = i + 1 end I
  F Next bytes2bstr = Strreturn End Function function GetURL (URL) Set retrieval = CreateObject ("Microsoft.XMLHTTP") With retrieval. Open ' get ', url, False. Send GetURL = Bytes2bstr (. responsebody) If Len (. responsebody) <2 then = "Remote communication failure!" "Call Logtofile (strcontent,1) Response.End End If End with Set retrieval = no end Function ' = = = = above is the custom function ======== S1 = INPUTBOX ("Original currency Code:", "Please enter the original currency code", "USD") s2 = INPUTBOX ("Destination Currency code:", "Please enter the destination currency code", "CNY") s = S1&s2 u RL = "http://download.finance.yahoo.com/d/quotes.csv?e=.csv&f=sl1d1t1&s=" &s& "=x" If S1<> ""and s2<> "" Then huilv = GetURL (URL) MsgBox Huilv End If
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.