I found this bit of code on there, and from the authors explanation, it looks like what I am looking for. But how do I make this work now?
**********************
Sub DeleteMessages()
Set myOlApp = CreateObject("Outlook.Appl
Dim myNameSpace As NameSpace
Set myNameSpace = myOlApp.GetNamespace("MAPI
Dim myExplorer As Explorer
Set myExplorer = myOlApp.ActiveExplorer
'Get the folder type, expected type is 0 i.e. mail folder. If other type of
folder
'being used then abort macro as it should only be used with mail folders.
folderType = myExplorer.CurrentFolder.D
'Check that folder is mail folder
If TypeName(myExplorer) = "Nothing" Or folderType <> 0 Then
GoTo invalidMailbox
End If
'Locate root folder for this account
Set thisFolder = myExplorer.CurrentFolder
Do Until thisFolder.Parent = myNameSpace
Set thisFolder = thisFolder.Parent
Loop
Set accountFolder = thisFolder
'Identify selected messages
Dim selectedItems As Selection
Set selectedItems = myExplorer.Selection
Dim currentMailItem As MailItem
Dim iterator As Long
'Run loop on selected messages
For iterator = 1 To selectedItems.Count
Set currentMailItem = selectedItems.Item(iterato
'Move messages to Deleted Items folder
Set trashFolder = accountFolder.Folders("Tra
currentMailItem.Move (trashFolder)
Next
'Now, purge deleted messages
Dim myBar As CommandBar
Set myBar = Application.ActiveExplorer
Dim myButtonPopup As CommandBarPopup
Set myButtonPopup = myBar.Controls("Edit")
Dim myButton As CommandBarButton
Set myButton = myButtonPopup.Controls("Pu
myButton.Execute
Exit Sub
invalidMailbox:
MsgBox ("Macro configured only to work with mail folders! ")
Exit Sub
End Sub
**********************
Where am I suppose to put this, or do with it or.... anything? Any help would be great, as I am no Outlook expert.
Main Topics
Browse All Topics





by: war1Posted on 2006-07-06 at 17:08:45ID: 17055231
Greetings, jetnet !
axel/compu ting/windo ws/deletin g- imap-mes sages-in-m icrosoft-o utlook
There is nothing natively in Outlook that will allow you to delete IMAP email to Trash. You can use a VBA Macro to move deleted email to Trash
http://www.segebrecht.com/
Best wishes!