• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Need help with VBA

jingramm

Senior member
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.
 
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.
 
Back
Top