?
Solved

Open file with changing month

Posted on 2014-07-23
3
Medium Priority
?
119 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 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
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…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

718 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