![]() |
|
|||||||
|
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
In my favorites section of Outlook I have the following: - Inbox - Sent Items - Deleted Items One morning I accidentally right clicked "delete all" under my "sent items" folder. Now over 7,400 emails are in my "deleted items" folder. I can manually select each email and move them back to the appropriate folder. However, I cannot select more than a few because of the file size. Is there a way to move all of these emails back to the "sent items" in one action? With over 7,400 emails it would take me several weeks to manually move them back. Appreciate any recommendations! |
|
#2
|
||||
|
||||
|
The following macro should work. Change the email address(es) to the address(es) you used to send the mails.
Code:
Sub Macro1()
Dim oItem As MailItem
Dim lngCount As Long
On Error Resume Next
For lngCount = Session.GetDefaultFolder(olFolderDeletedItems).Items.Count To 1 Step -1
Set oItem = Session.GetDefaultFolder(olFolderDeletedItems).Items(lngCount)
If TypeName(oItem) = "MailItem" Then
'Debug.Print oItem.SenderEmailAddress
Select Case oItem.SenderEmailAddress
Case "someone@somewhere.com" 'your email address
oItem.Move Session.GetDefaultFolder(olFolderSentMail)
Case "someoneelse@somewhere.com" 'another email address
oItem.Move Session.GetDefaultFolder(olFolderSentMail)
Case Else
End Select
End If
DoEvents
Next lngCount
MsgBox "Complete", vbInformation
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
VBA to move selected emails or conversation to current year pst folder
|
webharvest | Outlook | 1 | 08-15-2015 01:55 AM |
| Emails will not go to deleted items folder | VicV50 | Outlook | 0 | 03-22-2015 01:58 PM |
| Move emails to folder in drive and store in access database | megatronixs | Outlook | 0 | 11-21-2014 06:19 AM |
Move emails from one folder to another
|
smiler44 | Outlook | 9 | 11-20-2014 03:02 PM |
| move emails to folder with a subject that is similar | megatronixs | Outlook | 0 | 10-14-2014 03:05 AM |