這篇文章將為大家詳細(xì)講解有關(guān)如何使用vbs獲取雅虎匯率,小編覺(jué)得挺實(shí)用的,因此分享給大家做個(gè)參考,希望大家閱讀完這篇文章后可以有所收獲。
使用vbs獲取雅虎匯率
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) * &h200 + cint(nextcharcode)) i = i + 1 end if 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 strContent = "遠(yuǎn)程通訊故障!" Call LogToFile(strContent,1) response.end end if End With Set Retrieval = Nothing End Function '========以上為自定義函數(shù)======== s1 = INPUTBOX("原始貨幣代碼:","請(qǐng)輸入原始貨幣代碼","USD") s2 = INPUTBOX("目標(biāo)貨幣代碼:","請(qǐng)輸入目標(biāo)貨幣代碼","CNY") s = s1&s2 url = "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
關(guān)于“如何使用vbs獲取雅虎匯率”這篇文章就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,使各位可以學(xué)到更多知識(shí),如果覺(jué)得文章不錯(cuò),請(qǐng)把它分享出去讓更多的人看到。