How to increment the date
Dim myStr as string
dim dCtr as long
dim myDate as date
for dctr = 1 to 5
myDate = dctr - 1 + dateserial(2006,12,11)
mystr = "C:\somepath\" & format(myDate,"yyyymmdd") & ".txt"
'open the file named myStr
'do some work
'close that .txt file
next dctr
Tom wrote:
I use a macro to open the file 20061211.txt which is named after the date,
and extract some
data before closing it. I then repeat the process and open up the next file
20061212.txt and so on till I reach the last file 20061215.txt. I would
like to be able to use For N =1 to 5 and Next N, to automate the process but
I don't know how to increment the date by one each time. Any help will be
much appreciated.
TIA
Tom
--
Dave Peterson
|