Open text file based on date.

  • Thread starter Thread starter Dan Jordan
  • Start date Start date
D

Dan Jordan

I am in need of a way to open a text file based on the
date in a worksheet.
I have many text files saved as ST20061007.txt , ST20061006.txt ect. all
files start with ST then the
date. I need to be able to open each file based on
a date inputted into another cell in the workbook,
So if a user enters 10/6/2006 then it would open
the file ST20061006.txt.

Any help would be Great.

Dan
 
Hi Dan

You can try this with the date in A1 it open the file that is in C:\

Workbooks.OpenText "C:\ST" & Format(Range("A1"), "yyyymmdd") & ".txt", Origin:=xlWindows
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top