Delete files to recycle bin

  • Thread starter Thread starter Domino
  • Start date Start date
D

Domino

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

Many thanks

Domino
 
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://vbnet.mvps.org/code/shell/shfileopadv.htm

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.
 
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.
 
Back
Top