Solved

open file where year, month and file name change

Posted on 2014-07-29
3
173 Views
Last Modified: 2014-07-30
I need to open a file in a path

K:\\AllFiles\IES\Conversion Dept\Management\PM Reports\2014\07 Jul 14 [2014 will become 2015 and 07 Jul 14 will change each month 08 Aug 14]

the file name is ManagementFiles290714pm and this will change daily sp next day ManagementFiles300714pm etc

could an expert out there please provide me with VBA code to do this

Thanks
0
Comment
Question by:Jagwarman
[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

Expert Comment

by:Rgonzo1971
ID: 40226954
Hi,

pls try

strBgnPath = "K:\\AllFiles\IES\Conversion Dept\Management\PM Reports\"
strEndPath = StrConv(Format(Date, "yyyy\\mm mmm yy\\"), vbProperCase)
strFile = "ManagementFiles" & Format(Date, "yymmdd") & "pm"
strPathAndFile = strBgnPath & strEndPath & strFile

Regards
0
 

Author Comment

by:Jagwarman
ID: 40226997
Hi Rgonzo1971 it goes from start of code to end but does not open anything ??
0
 
LVL 52

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 40227072
If it's a XL file (suffix missing)

strBgnPath = "K:\\AllFiles\IES\Conversion Dept\Management\PM Reports\"
 strEndPath = StrConv(Format(Date, "yyyy\\mm mmm yy\\"), vbProperCase)
 strFile = "ManagementFiles" & Format(Date, "yymmdd") & "pm"
 strPathAndFile = strBgnPath & strEndPath & strFile
Workbooks.Open strPathAndFile
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

630 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