Deletion of file from VBA 
Author Message
 Deletion of file from VBA

I'm wondering how to delete a file from my local hard
drive via VB or VBA.  I've saved a BLOB to a file that I
insert into my Word 2000 document.. now I want to remove
the file that was saved to my local drive.
  I see there's a DeleteFile function with the Windows
API.. just wondering how to invoke this from my VBA code.  
thanks


Mon, 26 Jul 2004 23:24:52 GMT  
 Deletion of file from VBA
Hi Dan,

If you don't need to restore the file (for whatever reason), you can use the
Kill statement:

Kill "C:\FileName.extension"

This can be any file, not just a Word file.

HTH

Quote:
> I'm wondering how to delete a file from my local hard
> drive via VB or VBA.  I've saved a BLOB to a file that I
> insert into my Word 2000 document.. now I want to remove
> the file that was saved to my local drive.
>   I see there's a DeleteFile function with the Windows
> API.. just wondering how to invoke this from my VBA code.
> thanks



Mon, 26 Jul 2004 23:44:42 GMT  
 Deletion of file from VBA
But see:

How to delete files using VBA, including files which may be readonly
http://www.mvps.org/word/FAQs/MacrosVBA/DeleteFiles.htm

Regards

Dave


| Hi Dan,
|
| If you don't need to restore the file (for whatever reason), you can use
the
| Kill statement:
|
| Kill "C:\FileName.extension"
|
| This can be any file, not just a Word file.
|
| HTH

| > I'm wondering how to delete a file from my local hard
| > drive via VB or VBA.  I've saved a BLOB to a file that I
| > insert into my Word 2000 document.. now I want to remove
| > the file that was saved to my local drive.
| >   I see there's a DeleteFile function with the Windows
| > API.. just wondering how to invoke this from my VBA code.
| > thanks
|
|



Tue, 27 Jul 2004 02:55:48 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. vba module code for deletion

2. One more File Deletion question

3. File Deletion

4. File Deletions

5. Detecting deletion of files

6. INI File Key Deletion

7. File deletion in VB for Windows

8. deletion of files

9. deletion of files

10. Newbie Question. File Deletion Script

11. how to protect a file from deletion

12. Deletion of Open Files

 

 
Powered by phpBB® Forum Software