View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bernie Deitrick Bernie Deitrick is offline
external usenet poster
 
Posts: 5,441
Default Open file with variable date name based on current date

Workbooks.Open "C:\Foldername\" & Format(Now(),"yyyy mm") & " text.xls"

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

HTH,
Bernie
MS Excel MVP


"Ciprian" wrote in message
...
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