Delete files to recycle bin

Delete files to recycle bin

Post by Domin » Mon, 04 Oct 2004 19:38:35


What is the best way to use vba to delete image files &
send them to the recycle bin

Many thanks

Domino
 
 
 

Delete files to recycle bin

Post by Douglas J. » Mon, 04 Oct 2004 20:14:26

As far as I can tell, you can't use the VBA Kill statement, as that deletes
files, rather than putting them in the recycle bin.

You can, however, use the SHFileOperation API

Randy Birch has sample code at
http://www.yqcomputer.com/

However, note that Randy's site is aimed at VB programmers, not Access
programmers. There are significant differences in the controls available on
forms in VB vs. Access. His example uses DirListBox and FileListBox
controls, plus control arrays, none of which are available in Access.
Hopefully you'll be able to figure out from the code what needs to be done
to port the example into Access. If not, post back with whatever problems
you're having.

--
Doug Steele, Microsoft Access MVP
http://www.yqcomputer.com/
(no e-mails, please!)

 
 
 

Delete files to recycle bin

Post by Domin » Mon, 04 Oct 2004 21:07:48

Thanks Doug

That looked a little complex but we found what we needed
at www.applecore99.com/api/api018.asp

Tom
statement, as that deletes
programmers, not Access
controls available on
FileListBox
available in Access.
what needs to be done
whatever problems
message
 
 
 

Delete files to recycle bin

Post by Douglas J. » Mon, 04 Oct 2004 23:01:32

Yeah, that's the key part of the code.

Randy's example does lots of different things, which is one of the reasons
it looks so complicated.

--
Doug Steele, Microsoft Access MVP
http://www.yqcomputer.com/
(no e-mails, please!)