I am a VBA newbie to Outlook and barely understand VBA for Excel. I have looked all over for simple code I can edit that will allow me to simply move emails from specific email addresses to a folder in my Personal folders. Sounds easy but I have had no luck figuring it out. I did find Stock code but cannot figure out how to edit it for Outlook. I would have thought there would be a lot of easy samples since it seems this would be something frequently done. I want code to do this rather than using a Rule because we are limited on how many rules we are allowed to use.

I want to move emails from my default inbox folder (I believe that by using the default Inbox folder as my starting folder I do not have to use the full path) to a folder with the following path (I think)

The PST file is P:\PST\TestDataFile.pst
and I believe to get to the actual folder (TestDataFileNAMEfolder) you use this path:
\TestDataFileNAME\TestDataFileNAMEfolder


I would like to create code to move email from the email address emailaddress@sample.com to the folder noted above. Eventually I would like it to check for multiple emails and them move them to the correct corresponding folders. I guess I can figure that out possibly once I get the basics down.

I think the code below is close but I cannot figure out the code to (3) Do soemthing here....
Any help or advice would be greatly appreciated !


[VBA]

Private WithEvents Items As Outlook.Items
Private Sub Application_Startup()
Dim olApp As Outlook.Application
Dim objNS As Outlook.NameSpace
Set olApp = Outlook.Application
Set objNS = olApp.GetNamespace("MAPI")


' (1) default Inbox
Set Items = objNS.GetDefaultFolder(olFolderInbox).Items
End Sub
Private Sub Items_ItemAdd(ByVal item As Object)
On Error Goto ErrorHandler


' (2) only act if it's a MailItem
Dim Msg As Outlook.MailItem
If TypeName(item) = "MailItem" Then
Set Msg = item


' (3) do something here --- NEED HELP WITH THIS SECTION



End If
ProgramExit:
Exit Sub
ErrorHandler:
MsgBox Err.Number & " - " & Err.Description
Resume ProgramExit
End Sub


[/VBA]