Solved

open file where year, month and file name change

Posted on 2014-07-29
3
167 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
  • 2
3 Comments
 
LVL 48

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 48

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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Introduction This Article is a follow-up to my Mappit! Addin Article (http://www.experts-exchange.com/A_2613.html), it was inspired by an email posting I made to EUSPRIG (http://www.eusprig.org/index.htm), I will briefly cover: 1) An overvie…
Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
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…

705 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now