Data Source Changes

Parra

Well-known Member
Joined
Feb 21, 2002
Messages
752
This might be difficult, at least it is for me.

I have a macro that opens a data source c:data1.txt and formats the data.

The problem is that everyday I have to rename the data source to data1.txt.

Is there a way the macro can open the newest data file?
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
not quite sure what your asking here are you wanting to open data1 each day then save it as data1? can you explain more>
 
Upvote 0
I would like it to open the newest report with the word "data" in the begining.

ex.
data3.txt created 4/1
data5.txt created 4/6
data8.txt created 4/8

The macro would open the newest one, being data8.txt

I hope this helps.
 
Upvote 0
I could think of 1 with an input box and you could just enter 8 into it and it would open data8.xls would that help

would the number keep growing 9 , 10 , 11 etc
 
Upvote 0
Thats a good idea but I would want it to run automatically. Without me typing anything.

Just thought someone out there might have had an answer to this problem.

Thanks
 
Upvote 0
for example

Sub wkbopen()
Dim num As Long
num = CLng(InputBox("Enter Data Number"))
Workbooks.Open Filename:="C:Data" & (num) & ".txt"
End Sub
This message was edited by brettvba on 2002-04-29 17:03
 
Upvote 0
Well. If you don't need to keep those other txt files after you're done you can add this to the end of your macro:

kill c:mypathdata1.txt
 
Upvote 0

Forum statistics

Threads
1,213,513
Messages
6,114,072
Members
448,546
Latest member
KH Consulting

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top