Solved

Open file with changing month

Posted on 2014-07-23
3
117 Views
Last Modified: 2014-07-23
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
Comment
Question by:Seamus2626
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 51

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 40213818
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
 

Author Comment

by:Seamus2626
ID: 40213839
That looks good, that is picking the right file, now how do i open it?

Thanks
0
 

Author Closing Comment

by:Seamus2626
ID: 40213847
Got it

Workbooks.Open (strFile)
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question