We Recommend

Visual Basic 2008 Programmer's Reference Visual Basic 2008 Programmer's Reference
Visual Basic Orcas Programmer's Reference is a language tutorial and a reference guide to the upcoming Orcas release of Visual Basic. The tutorial provides basic material suitable for beginners but also includes in-depth content for more advanced developers.


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 

You need to login to post a comment.