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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Outlook Macro: Move Read Mail to New Folder

Status
Not open for further replies.

Rougy

Programmer
Oct 15, 2001
249
US
Hi,

Was wondering if anybody knew the syntax for moving an e-mail to another folder in a macro.

I've got a macro that strips the attachments and puts them in folders on various network drives, then it marks the file as read, and after than, I want to move it to a folder called "InboxDone".

Example:

Dim NewMailTime As Date
Dim NewItems As Items
Dim InboxItems As Items
Dim NewMailItem As MailItem
Dim MyAttachment As Attachment
Dim vNewFileName As String

For Each NewMailItem In InboxItems
If NewMailItem.UnRead Then
If NewMailItem.SenderName = "My Boss" _
And InStr(1, LCase(NewMailItem.Subject), "bossfile") Then
For Each MyAttachment In NewMailItem.Attachments
vNewFileName = MyAttachment.FileName
MyAttachment.SaveAsFile "O:\BossFiles\" + vNewFileName
NewMailItem.UnRead = False
? NewMailItem.Move (InboxDone) ?
Next
End If
Next

-----
The death of dogma is the birth of reason.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top