Assuming you've Declared the appropriate API functions, you can do this:
WConvertCurrency = CDbl(yahooHTTP.ResponseText)Įnd Function Example – get Foreign Exchange Rate using custom Functionīefore you start, check yahoo finance what the currency codes they use for exchange rate, such as EUR, AUD, GBP, USD. YahooHTTP.Open "GET", "" & currency1 & currency2 & "=X&f=l1" Public Function wConvertCurrency(currency1, currency2)ĭim yahooHTTP As New WinHttp.WinHttpRequest
The required code is simpler than you ever think. Insert a Module and then insert the below code. Press ALT+F11 > Tools > References > enable “Microsoft WinHTTP Services” This time we establish a connection to Yahoo and directly get the exchange rate using User Defined Function. Yahoo Finance is designed in the way to facilitate you to get data. Now the exchange rate table is inserted and constantly updates In this Properties box, you can set how long the Excel table will refresh and get the latest data from website. Select a Cell to import, and then click on Properties button Click on the on the yellow arrow (it will turn green), then press Import button. The yellow arrows you see are the tables you can import into Excel. Get Foreign Exchange Rate in Excel (non-VBA) Some people like using Yahoo Finance, but I personally believe Yahoo may change their interface more often and it may destroy the Excel connection. To begin with, look for a dynamic website that contains foreign exchange rate where the database constantly refreshes. Get exchange rate using VBA Access FunctionĮxcel currency converter template Foreign Exchange Rate WebsitesĮxcel allows you to create an external connection to website where you can get the data directly in the spreadsheet.
This Excel tutorial explains how to get foreign exchange rate in Excel using VBA and non-VBA.