Tom Gribbin wrote:
> If anyone could help me out here I would be eternally grateful.
>
> I have scheduled a data I am using to retrive some information that I
> require every day at a set time into a single excel spreadsheet. So
> far so good – this works fine. However, every time the new updated
> data is imported into the spreadsheet, it overwrites the exisating
> data in the spreadsheet losing me the previous days data.
>
> Is it possible to schedule a macro within windows to copy the file
> which the data imports into and then paste it as a file with a new
> name e.g. ‘data (dd-mm-yyyy)' so that I build up a folder containing
> new files of each days data whilst the original file can just be
> overwritten each day and only contain that days data.
>
> I am using Windows 2000 Professional and presume I can use scheduled
> tasks to do this but do not have a clue how to go about this. Any
> advise would be really appreciated.
Assuming that on your system the built-in %date% variable has the
format
<Win2000> c:\cmd>echo %date%
Fri 11/28/2003
you could do
copy datafile.dat "data %date:~10,4%-%date:~4,2%-%date:~7,2%.dat"
In the long run, you will be much happier if you use a date format
like yyyy-mm-dd rather than dd-mm-yyyy in your file names. :-) And
you should avoid the use of parentheses in your file names!
--
Phil Robyn
Univ. of California, Berkeley
u n z i p m y a d d r e s s t o s e n d e - m a i l
|