Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

open file where year, month and file name change

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

Technology Partners: 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

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
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…
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 will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

722 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