Use vbs to get Yahoo! Exchange Rate

Source: Internet
Author: User
This article mainly introduces the code and ideas for getting Yahoo! exchange rates using vbs. For more information, see use vbs to get Yahoo! exchange rates.

Function bytes2bstr (vin) strreturn = "" for I = 1 to lenb (vin) thischarcode = ascb (midb (vin, I, 1 )) if thischarcode <& 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 if next bytes2bstr = strreturnEnd FunctionFunction GetURL (url) Set Retrieval = CreateObject ("Microso Ft. XMLHTTP ") With Retrieval. open "GET", url, False. send GetURL = bytes2bstr (. responsebody) if len (. responsebody) <2 then strContent = "remote communication fault! "Call LogToFile (strContent, 1) response. end if End With Set Retrieval = NothingEnd function' ======== the above are custom functions ======== s1 = INPUTBOX ("original currency code: "," Enter the original currency code "," USD ") s2 = INPUTBOX (" target currency code: "," Enter the target currency code "," CNY ") s = s1 & s2url =" http://download.finance.yahoo.com/d/quotes.csv?e=.csv&f=sl1d1t1&s= "& S &" = x "if s1 <>" "and s2 <>" "Then huilv = GetURL (url) MsgBox huilvEnd if

For more articles about using vbs to get Yahoo!

Related Article

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.