MACRO to auto delete file at a certain date?

H

Haroon

hi

when i create a document using template with macro/form, onces its saved as
a document, i want that file to be deleted after a month, is there a way of
doing this? this file is stored on network drive, so the macro should
activate lets say on 28 feb 2009 at 00:00 and deletes the file.

any one know how to do this?

thanks in advance :)
 
J

Jay Freedman

Haroon said:
hi

when i create a document using template with macro/form, onces its
saved as a document, i want that file to be deleted after a month, is
there a way of doing this? this file is stored on network drive, so
the macro should activate lets say on 28 feb 2009 at 00:00 and
deletes the file.

any one know how to do this?

thanks in advance :)

This is not going to work if you try to do it with a macro in the template.
The simple reason is that at the time you want the document to be deleted,
Word must be running and that template must be loaded in it (and macros must
be enabled, if that's a consideration) to allow your macro to execute. You
also need some event that causes your macro to start running; there's
nothing in Word that happens at any specific time. There's no assurance that
any of that will happen.

Instead, you should use Windows Scheduler to run a program (probably not
Word) or a script such as VBScript, that examines all the files in
appropriate folders on the network drive, determines which ones are old
enough (based on their file creation dates), and deletes them.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
G

Gordon Bentley-Mix

Alternatively, if the volume of documents is sufficient to justify the
expense, you might consider an electronic document management system. Many of
these products include some sort of "records management" functionality that
can be set up to archive or delete documents according to a schedule.
However, EDMS products are not cheap, and most single users and small offices
would consider them to be a very big hammer for driving a very small nail.
--
Cheers!

Gordon Bentley-Mix
Word MVP

Uninvited email contact will be marked as SPAM and ignored. Please post all
follow-ups to the newsgroup.
 

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