Pull data from a website

hughess7

Registered User.
Local time
Today, 18:09
Joined
Dec 2, 2010
Messages
27
Hi I am trying to read some data off a website for Exchange Rates. I found some code for a similar task and tried amending it for my use but instead of opening the website I get the download centre on my PC asking me if I want to open or save the file. Can anyone help with this please?

Dim ie As Object, strSource As String, strSQL As String
Dim strCountry As String, intMultiplier As Integer, sngRate As Single
Dim rs As Recordset, StartFrom As String

Set ie = CreateObject("internetexplorer.application")
' No need to show the user the web page if we're just getting values from it
ie.Visible = False

Set rs = CurrentDb.OpenRecordset("SELECT * FROM tblCurrencies")
'Check to see if the recordset actually contains rows
If Not (rs.EOF And rs.BOF) Then
rs.MoveFirst
Do Until rs.EOF = True
StartFrom = rs!txtCurrency
' Open the web page in our custom object
ie.navigate "http://rate-exchange.appspot.com/currency?" & "from=" & StartFrom & "&" & "to=GBP"

' Wait until the web page is done loading
TryAgain:
While ie.busy
DoEvents
Wend

' Get the outerHTML, which includes the XML on the web page
On Error GoTo TryAgain
strSource = ie.Document.body.outerHTML
On Error GoTo 0

rs!ExRate = Mid(strSource, 22, 19)
rs.Update
rs.MoveNext
Loop
End If
 
I receive the same error in IE. I don't receive it in Firefox though. The error happens when you want to navigate to the site.
 

Users who are viewing this thread

Back
Top Bottom