How to "Scrape" currency conversions off web... Maybe using Google

M

MikeZz

I have a workbook with a table of currency exchange rates shown below.
How can I write a function or macro that can extract the latest or average
exchange rate from the internet and place it in the cells that have "val"?

I think the term I've heard of is "Scraping" but that aspect of vba is new
to me.

I was thinking the easiest way would be to create a string and send it to
Google Search because if I put "Convert 1 USD to EUR" in the search bar, it
gives the me exchange rate.

Currency EUR USD JPY Baht
EUR 1.00 USD
USD val 1.00 JPY
JPY val val 1.00 Baht
Baht val val val 1.00
Thanks! MikeZz
 
D

Don Guillett

Send your email to me and I will send you a workbook using an external query
to
http://finance.yahoo.com/currency/convert?amt=100&from=usd&to=jpy&submit=Convert
or establish the query using the above and this macro assigned to a
button/shape
You will need defined names for [amount] 100, [to] usd, & [from] jpy
Sub ConvertCurrency()
With Sheets("Sheet1").QueryTables(1)
.Connection = _
"URL;http://finance.yahoo.com/currency/convert?amt=" _
& [amount] & "&from=" & [from] & "&to=" & [to] & "&submit=Convert"
.Refresh BackgroundQuery:=False
End With
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top