[AccessD] Exchange Rate - Currency Converter thingy

Salakhetdinov Shamil mcp2004 at mail.ru
Fri Jun 29 04:46:07 CDT 2012


Hi Gustav --

Do you mean downloading and parsing source XML byte by byte?
 
Thank you.

-- Shamil

Fri, 29 Jun 2012 11:42:46 +0200 от "Gustav Brock" <gustav at cactus.dk>:
 
  
  
Hi Shamil

"naive-hardcoder" ... he he, quick and dirty, next step would be to just download the xml-string and parse it.

/gustav


>>> mcp2004 at mail.ru 29-06-12 11:07 >>>
Hi All --

Here is my final code sample for the subject task - I'd call it "naive-hardcoder" approach:

Public Sub TestMe1()
Dim uri As String
uri = "http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml"
Dim xmlDoc As New MSXML2.DOMDocument30
xmlDoc.async = False
xmlDoc.Load (uri)
Dim xml As String
xml = xmlDoc.DocumentElement.xml
Dim pos1 As Integer
Dim pos2 As Integer
Dim currencyCode As String
currencyCode = "RUB"
pos1 = InStr(xml, "currency=""" + currencyCode)
pos1 = InStr(pos1, xml, "rate=""")
pos1 = InStr(pos1 + 1, xml, """")
pos2 = InStr(pos1 + 1, xml, """")
Dim currencyRate As String
currencyRate = Mid(xml, pos1 + 1, pos2 - pos1 - 1)
Debug.Print "EUR/" + currencyCode + " => " + currencyRate
End Sub

Thank you.

-- Shamil

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
    


More information about the AccessD mailing list