Open file with variable date name based on current date

  • Thread starter Thread starter Ciprian
  • Start date Start date
C

Ciprian

Hello,

I have a folder containing different .xls report files with the name format
"YYYY MM text.xls", where YYYY stands for year, MM for month.

I need a macro which, when run from an excel file saved in a different
loacation, based on the current date, e.g. January 7, 2009, will open the
file "2009 01 text.xls".

Thanks for your help,
Ciperian
 
Workbooks.Open "C:\Foldername\" & Format(Now(),"yyyy mm") & " text.xls"

Except it will open 2010 01 text.xls ;-)

HTH,
Bernie
MS Excel MVP
 
Back
Top