Self-Delete a file 
Author Message
 Self-Delete a file

Can you make a Word Document delete itself?  Can't delete
it while it's open, because you get ye olde Path/File
Access Error.  Can't delete it when it's closed, because
that terminates the code.

Any thoughts?

Thanks,

Paul



Sat, 20 Nov 2004 01:49:16 GMT  
 Self-Delete a file
Hi Paul,

You can try

Dim fs
Set fs = CreateObject("Scripting.FileSystemObject")
fs.deletefile ("C:\Test.doc")

Or, you can try
Kill "C:\Test.doc"

HTH

Quote:
> Can you make a Word Document delete itself?  Can't delete
> it while it's open, because you get ye olde Path/File
> Access Error.  Can't delete it when it's closed, because
> that terminates the code.

> Any thoughts?

> Thanks,

> Paul



Sat, 20 Nov 2004 02:54:14 GMT  
 Self-Delete a file
I've tried the Kill, and that doesn't work.  I'm guessing
that using the filesystemobject will have similar results,
but I'll give it a try - I haven't gone that avenue, yet.

I'll let you know what happens.

Thanks,

Paul

Quote:
>-----Original Message-----
>Hi Paul,

>You can try

>Dim fs
>Set fs = CreateObject("Scripting.FileSystemObject")
>fs.deletefile ("C:\Test.doc")

>Or, you can try
>Kill "C:\Test.doc"

>HTH


>> Can you make a Word Document delete itself?  Can't
delete
>> it while it's open, because you get ye olde Path/File
>> Access Error.  Can't delete it when it's closed, because
>> that terminates the code.

>> Any thoughts?

>> Thanks,

>> Paul

>.



Sat, 20 Nov 2004 03:11:32 GMT  
 Self-Delete a file
Hi Paul,

I never found a way to do it, even when doing a Save As, Word maintains a
connection to the old file, such that it can't be deleted correctly.
What I did as a work around is when a file is to die, from Word the name of
the file is written to a text file. I then have a VB app that runs in the
background that periodically scans the ToDie.txt file. and kills the docs
when it can (usually within a few seconds) after Word releases them from
memory.

The kill isn't immediate, but it is effective.

HTH and have a great day!
--
~~~~~~~~~~~~~~~~~~~~~~
Stephen Lang
401 S. Carson Street
Carson City, NV 89703
775.684.6830
GMT-8
slangatlcb state nv us
~~~~~~~~~~~~~~~~~~~~~~
To respond via e-mail:


Quote:
> Can you make a Word Document delete itself?  Can't delete
> it while it's open, because you get ye olde Path/File
> Access Error.  Can't delete it when it's closed, because
> that terminates the code.

> Any thoughts?

> Thanks,

> Paul



Fri, 26 Nov 2004 22:35:24 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. fso.delete(self) - how to refer to self?

2. delete items in DeletedItems Folder of self added .pst file

3. Self delete

4. self deleting executable?

5. Task Scheduler API self delete job

6. Self Delete or modify

7. Self Delete--ANSWER!!

8. Self Delete-explain

9. Self Delete--explain again

10. Self Delete

11. SELF DELETE-TELL

12. SELF DELETE-NOT VIRUS!!!

 

 
Powered by phpBB® Forum Software