Outlook - How to Back Up emails in Outlook 2010
Asked By Rajender Prasad on 26-Jan-12 04:17 AM
Dear All,
I receive many emails everyday from different senders.
I have set some rules to some senders where all the realted mails will go into specific folder in inbox.
Now, I need to drop all those emails to D:\ drive after running a rule or by using any Macro.
Please help me.
Prasad
D Company replied to Rajender Prasad on 26-Jan-12 04:24 AM
Hello Friend,
here is macro to move to take outlook backup
Sub MoveToFiled()
On Error Resume Next
Dim ns As Outlook.NameSpace
Dim moveToFolder As Outlook.MAPIFolder
Dim objItem As Outlook.MailItem
Set ns = Application.GetNamespace("MAPI")
'Define path to the target folder
Set moveToFolder = ns.Folders("Mailbox - Jim Merrell").Folders("@Filed")
If Application.ActiveExplorer.Selection.Count = 0 Then
MsgBox ("No item selected")
Exit Sub
End If
If moveToFolder Is Nothing Then
MsgBox "Target folder not found!", vbOKOnly + vbExclamation, "Move Macro Error"
End If
For Each objItem In Application.ActiveExplorer.Selection
If moveToFolder.DefaultItemType = olMailItem Then
If objItem.Class = olMail Then
objItem.move moveToFolder
End If
End If
Next
Set objItem = Nothing
Set moveToFolder = Nothing
Set ns = Nothing
End Sub
for more detail visit this link
http://jmerrell.com/2011/05/21/outlook-macros-move-email/
Regards
D
Rajender Prasad replied to D Company on 26-Jan-12 04:32 AM
Thanks..but when I paste this code to my outlook VBA, getting an error All Macros have been disabled.
How to use this code.
second thind, where can I give my Path in this code.
Prasad