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.

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

Set objItem = Nothing
Set moveToFolder = Nothing
Set ns = Nothing

End Sub

for more detail visit this link

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.

D Company replied to Rajender Prasad on 26-Jan-12 05:54 AM
Hello Rajendar,

i have given you a link also,request you to browse that link . you will get all the details

here is the link.


Sri K replied to Rajender Prasad on 26-Jan-12 06:09 AM