Downloading an Excel file from the web

What to do when the file name changes monthly?

By Jeff Robson

Client problem: how to download an Excel file each month containing foreign exchange rates when the file name changes all the time.

Here, you can’t just record a macro to get the code you need.  You must write a little VBA to get this done.

The solution we provided allows for input of all parameters on the setup sheet using various fields (e.g. [StartMonth]).

These are then replaced by the VBA code when it runs with the actual values from the sheet to generate a flexible file name and URL.

The end result is a very flexible macro that could be very easily adapted to almost any situation.

Download Excel File