- 1). Open Outlook by double-clicking the icon that is located on your desktop. You can also do this by clicking the "Start" button and accessing it directly from the "Start" menu.
- 2). Click on the "Tools" button within the Toolbar and hover over the "Macro" option. From here, click on the option that reads "Visual Basic Editor."
- 3). Enter the following Visual Basic script in the Visual Basic Editor in Outlook 2007:
Sub MoveToArchive()
On Error Resume Next
Dim objFolder As Outlook.MAPIFolder
Dim objNS As Outlook.NameSpace, objItem As Outlook.MailItem
Set objNS = Application.GetNamespace("MAPI")
Set objFolder = objNS.Folders("Personal Folders").Folders("Ancient Archive")
'Assume this is a mail folder
If objFolder Is Nothing Then
MsgBox "This folder doesn't exist!", vbOKOnly + vbExclamation, "INVALID FOLDER"
End If
If Application.ActiveExplorer.Selection.Count = 0 Then
'Require that this procedure be called only when a message is selected
Exit Sub
End If
For Each objItem In Application.ActiveExplorer.Selection
If objFolder.DefaultItemType = olMailItem Then
If objItem.Class = olMail Then
objItem.UnRead = False
objItem.Move objFolder
End If
End If
Next
Set objItem = Nothing
Set objFolder = Nothing
Set objNS = Nothing
End Sub - 4). Edit the Visual Basic maco line that sets the destination folder for Outlook 2007 to move the message to from "Ancient Archive" to the name of the personal folder in your Outlook 2007 PST. For example,
Set objFolder = objNS.Folders("Personal Folders").Folders("Your Mail Folder Name Here") - 5). Choose the "Save" menu button and restart Outlook 2007. The macro will move all email that is read to your personal folder in the Outlook PST.
SHARE