Solved

Open file with changing month

Posted on 2014-07-23
3
118 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 52

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

Ready to get started with anonymous questions?

It's easy! Check out this step-by-step guide for asking an anonymous question on Experts Exchange.

Question has a verified solution.

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

How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
After seeing numerous questions for Dynamic Data Validation I notice that most have used Visual Basic to solve the problem. This suggestion is purely formula based and can be used in multiple rows.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

623 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