Access Personal Folders - Inbox Subfolder

Joined
Apr 10, 2008
Messages
1
Reaction score
0
I've been looking around and playing with code all morning. I am trying to use VBA to copy emails (utilizing outlook 2003) from my exchange folder into a subfolder of my inbox in my Personal Folders. Here is my directory structure:

|-Mailbox - danger, ace
|--Inbox (exchange)
|-Personal Folders
|--Inbox
|---Follow up

What I'm trying to do is keep a copy of each email in both Inboxes AND copy emails from specific people into the "follow up" subfolder. I've put the following code together based on what I've read online this morning.

Currently, my code looks like this:
Code:
Sub ProcessIncoming(mi As MailItem)
 On Error GoTo CustomMailMessageRule_Error
 	Dim myNameSpace As Outlook.NameSpace
 	Dim myPST As Outlook.MAPIFolder
 	Dim myFolder As Outlook.MAPIFolder
 	   
 	Set myNameSpace = Application.GetNamespace("MAPI")
 	Set myPST = myNameSpace.Folders("Personal Folders")
 	
 	If myPST Is Nothing Then
 		MsgBox "The 'Personal Folders' folder cannot be located!!"
 		Exit Sub
 	End If
 	
 	Set myFolder = myNameSpace.Folders("Follow up")
 	If myFolder Is Nothing Then
 		MsgBox "The 'Follow up' folder cannot be located!!"
 		Exit Sub
 	Else
 		mi.Copy myFolder
 	End If
 	
 	
 	On Error GoTo 0
 	Exit Sub
 	
 CustomMailMessageRule_Error:
 		MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure"
 		Resume Next
 End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top