Answer the question
In order to leave comments, you need to log in
How to open a file with a dynamic name using VBA?
It was not possible to collect a working answer in Google.
I have a macro that processes a file with the current date in the title:
Dim my_file As Worksheet
Set my_file = Workbooks.Open(Filename:=ThisWorkbook.Path & "\important file" & Date & ".xlsx").Sheets(1)
'do anything
Workbooks("important file" & Date & ".xlsx").Close SaveChanges:=False
Answer the question
In order to leave comments, you need to log in
- read a list of files from a folder
- check if the beginning of the file name matches "important file"
- process the files from the received list with your macro in turn, if there are several of them
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question