[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 121
  • Last Modified:

Open file with changing month

Hi,

I have a file called

Call_Report_June_2014.xlsx

next month it will be

Call_Report_July_2014.xlsx

It will be ran on the 01/08/2014


Can i get some code that recognises the last month, so on 01/08/2014 - it will seek file name

Call_Report_July_2014.xlsx

on the 01/09/2014 it will seek file name

Call_Report_September_2014.xlsx


Many thanks
0
Seamus2626
Asked:
Seamus2626
  • 2
1 Solution
 
Rgonzo1971Commented:
Hi,

pls try

thedate = Date - 10 ' 10 instead of 1 as security for holidays
strFile = "Call_Report_" & StrConv(Format(thedate, "MMMM_YYYY"), vbProperCase) & ".xlsx"

Regards
0
 
Seamus2626Author Commented:
That looks good, that is picking the right file, now how do i open it?

Thanks
0
 
Seamus2626Author Commented:
Got it

Workbooks.Open (strFile)
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now