I am new to VBA and trying to create a module that will function like a Rule in Outlook 2003. I am aware that there is specific code for this in Outlook 2007, but I don't have that luxury as of yet.
This rule be applied to a message that has just been sent.
It will be used on the "From" category for outgoing mail.
It will also be moved to a folder on a shared drive to which I have access.
I tried to think around the problem and decided to go about it differently since my coding skills are limited. Below is the attempt, although it may have been a poor one. Is there any help that can be given?
PSub NewRule()
Dim MoveAction As Outlook.MailItem
Dim MailOutLook As Outlook.MailItem
Dim SentItems As Outlook.Folder
Dim MoveTarget As Outlook.Folder
Set SentItems = Application.Session.GetDefaultFolder(olFolderInbox)
Set MoveTarget = SentItems.Folders("Parking Administration")
Set MailOutLook = CopyItem(olMailItem)
With MailOutLook
.Recipients.Add ("Parking Administration")
.Recipients.ResolveAll
End With
Set MoveAction = MoveItem(olMailItem)
With MoveAction
.Folder = MoveTarget
End With
End Sub
This rule be applied to a message that has just been sent.
It will be used on the "From" category for outgoing mail.
It will also be moved to a folder on a shared drive to which I have access.
I tried to think around the problem and decided to go about it differently since my coding skills are limited. Below is the attempt, although it may have been a poor one. Is there any help that can be given?
PSub NewRule()
Dim MoveAction As Outlook.MailItem
Dim MailOutLook As Outlook.MailItem
Dim SentItems As Outlook.Folder
Dim MoveTarget As Outlook.Folder
Set SentItems = Application.Session.GetDefaultFolder(olFolderInbox)
Set MoveTarget = SentItems.Folders("Parking Administration")
Set MailOutLook = CopyItem(olMailItem)
With MailOutLook
.Recipients.Add ("Parking Administration")
.Recipients.ResolveAll
End With
Set MoveAction = MoveItem(olMailItem)
With MoveAction
.Folder = MoveTarget
End With
End Sub