Posted By

corydeppen on 10/30/07


Tagged

access vba 2003 vb


Versions (?)

Get Currency Exchange Rate


 / Published in: Visual Basic
 

  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
Posted By: glctesta on May 14, 2011

Hi, great demo, can you help me? I would like to get the all currency exchange rate list and not versus USD only... can you give me an idea? Thank you a lot. Gianluca

You need to login to post a comment.