Scheduled tasks - macros

T

Tom Gribbin

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.
 
P

Pegasus \(MVP\)

Where does the data come from that you wish to import?
Is it an existing file? Does the file have a fixed name?
Is it the previous day's file? An example might be helpful
in explaining what you're trying to achieve.
 
P

Phil Robyn

Tom said:
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!
 

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

Top