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.
 

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

Similar Threads

Windows 7 Recycle Bins Corrupt - No File List 1
Recycle bin problems 5
restore files still in recycle bin 3
Discover when Recycle Bin emptied? 3
Deleting and the recycle bin 3
Recycle bin 8
Recycle Bin Problem 3
Recycle Bin 6

Back
Top