Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Moving a sent message to a shared folder using Outlook VBA

Status
Not open for further replies.

Googled

Technical User
Jun 27, 2007
1
US
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top