Get Currency Exchange Rate


/ Published in: Visual Basic
Save to your folder(s)



Copy this code and paste it in your HTML
  1. ' Gets current exchange rate for Canadian dollar
  2. '
  3. ' Code Source: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=689249&SiteID=1
  4. ' Data Source: http://finance.yahoo.com/q?s=USDCAD=X
  5. '
  6. Function getExchangeRate() As String
  7.  
  8. Dim HttpReq As New MSXML2.XMLHTTP40
  9. Dim url, arr, delim, resp As String
  10.  
  11. delim = ","
  12. url = "http://download.finance.yahoo.com/d/quotes.csv?s=USDCAD=X&f=sl1d1t1c1ohgv&e=.csv"
  13.  
  14. HttpReq.Open "GET", url, False
  15. HttpReq.send
  16.  
  17. resp = HttpReq.responseText
  18.  
  19. arr = Split(resp, delim)
  20.  
  21. getExchangeRate = arr(1)
  22.  
  23. End Function

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.