Need a Script for handling moved mail from inbox

Stig Arvidsson

New Member
Outlook version
Outlook 2007
Email Account
Hello Outlook developers. I am new on developing in outlook and I need a walk true to make a script that send message back to sender when I have read the message and after moving mail to a new catalog.

Thank you in advance
Stig Arvidsson

Forum Admin

Senior Member
We'll use the code here - - as the basis for the message (i assume you are sending a new message, not a reply) If you want to reply and move, i'd start with - click the reply button, and move the message.

That leaves us with something like this - add it to a button to use.
Sub MoveMail()
    Dim objNamespace As Outlook.NameSpace
    Dim objDestFolder As Outlook.folder
    Dim objMail As MailItem
    Dim objMsg As MailItem
    Set objNamespace = Application.GetNamespace("MAPI")
    ' use your datafile name and each folder in the path
Set objDestFolder = objNamespace.GetDefaultFolder(olFolderInbox).Folders("1Test")
Set objMail = Application.ActiveExplorer.Selection.Item(1)

Set objMsg = Application.CreateItem(olMailItem)
With objMsg
  .To = ""
  .CC = ""
  .subject = "This is the subject"
  .BodyFormat = olFormatHTML
End With

objMail.Move objDestFolder

Set objMsg = Nothing

Set objDestFolder = Nothing
End Sub
Basics of using VBA Editor is here: