Macro to delete contents of folder

  • Thread starter Thread starter Big Al
  • Start date Start date
B

Big Al

I need a macro that could be assigned to a button that would delete the
contents of a folder ( Matador Junk Files) and then empty the contents of
the deleted items folder.

Any suggestions?


AL
 
It looks like you are trying to permanently delete messages. You can do
that with CDO:

Dim objSession As New MAPI.Session, objMessage As Object, objCMessage As
MAPI.Message

objSession.Logon , , , False

For Each objMessage In Application.ActiveExplorer.Selection
Set objCMessage = objSession.GetMessage(objMessage.EntryID)
objCMessage.Delete
Next

This code deletes the selected messages in a folder, but you can get the
Items collection of any MAPIFolder object and do the same thing with the
messages in that collection.
 
Back
Top