Need help with VBA

jingramm

Senior member
Oct 25, 2009
779
2
76
I am building an Excel macro to do the following

Within the macro, I need to open a certain file and copy something from it. However, the file name of the file changes everyday. What is the best way to handle this?

Is there a macro where I can have it point to a folder and have the user select the file through a quick pop up window? Once the user clicks on the file name, the macro will open this file and copy something from it.
 

PowerEngineer

Diamond Member
Oct 22, 2001
3,615
799
136
If the file name changes in some predictable way then you can build the (directory and) file name as a string in the macro and then use that string with Workbook.Open if it's an Excel file or OpenTextFile if not.

If you want to have the user select files, then take a look at FileDialog.