Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Please advice

Posted on 2011-02-15
4
Medium Priority
?
240 Views
Last Modified: 2012-05-11
I want to check a excell sheet which reside under a folder like C:/Temp/2/14/11/test.xls for February 14th file and like C:/Temp/02/15/11/test.xls. for Feb 15th file and so on....
Please advice me the VBA code to read the file everyday to check.

Your prompt response would be highly appreciated.
0
Comment
Question by:alam747
  • 2
4 Comments
 
LVL 46

Accepted Solution

by:
tbsgadi earned 2000 total points
ID: 34904346
Something like this:
Gary
Dim ObjEx As Excel.Application
Set ObjEx = New Excel.Application

With ObjEx

       .Workbooks.Open FileName:="C:/Temp/" & Format(Date, "m/dd/yy") & "/test.xls"
end with

...

Open in new window

0
 
LVL 37

Expert Comment

by:TommySzalapski
ID: 34908012
I also recommend changing the format to C:/Temp/2011/02/14/test.xls so that the sorting will make sense and all the data will be grouped into folders by year. The way you have it currently, the folders will be grouped in very strange ways.

The yyyy/mm/dd format is what most people in industry use for filenames and paths.
0
 

Author Closing Comment

by:alam747
ID: 34908847
Thanks a lot , it helps
0
 
LVL 46

Expert Comment

by:tbsgadi
ID: 34908984
Glad to help!
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

As with any other System Center product, the installation for the Authoring Tool can be quite a pain sometimes. This article serves to help you avoid making these mistakes and hopefully save you a ton of time on troubleshooting :)  Step 1: Make sur…
Many companies are making the switch from Microsoft to Google Apps (https://www.google.com/work/apps/business/). Use this article to learn more about what Google Apps has to offer and to help if you’re planning on migrating to Google Apps. It is …
Viewers will learn the different options available in the Backstage view in Excel 2013.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

916 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