Need a Script for handling moved mail from inbox

Status
Not open for further replies.

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 - http://www.slipstick.com/developer/create-a-new-message-using-vba/ - 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 http://www.slipstick.com/developer/vba-sample-reply-reply-clicked/ - click the reply button, and move the message.

That leaves us with something like this - add it to a button to use.
Code:
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 = "Alias@domain.com"
  .CC = "Alias2@domain.com"
  .subject = "This is the subject"
  .BodyFormat = olFormatHTML
  .Display
End With


objMail.Move objDestFolder

Set objMsg = Nothing

Set objDestFolder = Nothing
End Sub
Basics of using VBA Editor is here: http://www.slipstick.com/developer/how-to-use-outlooks-vba-editor/
 
Status
Not open for further replies.
Thread starter Similar threads Forum Replies Date
D Need Help with Script. Keep getting Runtime Error 438 BCM (Business Contact Manager) 4
S Outlook 2010, need script for rules & Warnings Using Outlook 3
J Moved many emails to Outlook external folder, need to delete on Gmail server Using Outlook 13
A Wishlist Arthur workman I need the community's assistance thank you Using Outlook 3
A from Arthur to anyone I need your expertise assistance Using Outlook.com accounts in Outlook 7
Marc2019 Need help please! Cannot Setup my outlook email account on my Mac Outlook 2011 Using Outlook.com accounts in Outlook 2
T Need to backup outlook.com to cloud storage, without desktop software - Testing UpSafe. Are there any similar services? Using Outlook.com accounts in Outlook 8
C need help setting up outlook first time Using Outlook 1
N Need help syncing contacts to iPhone X Using Outlook 8
L Need to import multiple Outlook files to Office 365 Account Using Outlook 4
S Received mail as part of DL, need to auto-CC the same when replying Outlook VBA and Custom Forms 5
C Need VBA code to automatically save message outside outlook and add date Outlook VBA and Custom Forms 1
S Error using AddressEntry.GetContact - need help Outlook VBA and Custom Forms 2
EaglePI Outlook 2010 need help with rules Using Outlook 0
Horsepower Need iCloud mail only Using Outlook 1
O Don't need any add-ins at all? Using Outlook 2
B Need Help - Willing to pay Outlook VBA and Custom Forms 10
A Need to view Outlook calendar in Sharepoint .. Using Outlook 2
J Need Help with Contacts VBA Outlook VBA and Custom Forms 1
L Accidentally merged a calendar with .ics, need to undo! Using Outlook 1
H Need help setting up GetFolderPath-Makro with Vodafone IMAP Mail-Account Outlook VBA and Custom Forms 0
D Need Genuine Office or Outlook 2007 Using Outlook 3
G how to cancel a recurring meeting but not the organizer but all attendees need to know. Using Outlook 1
H I need a developer to customize an Outlook Contact form Outlook VBA and Custom Forms 0
T Need help with finding/updating task Outlook VBA and Custom Forms 1
N Need a case sensitive rule Outlook VBA and Custom Forms 1
C Need rule to alert when an email has not been replied to within 24 hours Using Outlook 1
P Outlook 2003 - Do I need a new profile? Using Outlook 2
F Outbox - Multiple Emails need to be manually opened? Using Outlook 5
Miquela I need to make a calendar to share here at work with 40 other people Using Outlook 1
S Need CC: to show the original To: recip[ients Using Outlook 4
Denis Hi everyone!!! Need some help with Excel to Exchange Calendar??PLEASE>>> Using Outlook 1
D Need to extract a line from a word attachment, and add it to the subject line Outlook VBA and Custom Forms 3
Mary B VBscript: Need to copy every email to a folder & mark that copy as read Outlook VBA and Custom Forms 5
mikecox Desperat; need hands on support Using Outlook 1
E Need Help on Setting up a repeated Reminder on Task with Reoccurence Every Year Using Outlook 6
Glyn Do I Need Outlook.com Using Outlook 1
B Need Help Creating Email Based on Subject w Address in Body Outlook VBA and Custom Forms 1
G Need help configuring a PRF for Outlook 2010 and 2013 Using Outlook 0
K Excel Import Option: Need Help Updating Existing Records BCM (Business Contact Manager) 0
K Need help concerning emails linking to BCM. BCM (Business Contact Manager) 0
C Outlook 2010, Need to restrict domain users from installing any sort of a addin in outlook Using Outlook 2
J Need help with installation of BCM in Outlook2013 BCM (Business Contact Manager) 5
F Outlook 2010 - Need help with a custom field. Using Outlook 3
icacream I just need to copy my address book to my new laptop ! Using Outlook 18
R Need help getting BCM to work with my Outlook 2014 Using Outlook 4
V Need to add some text in subject while creating new mails - NEED VB CODINGS Using Outlook 4
E Need a bit of education on how Outlook works please Using Outlook 3
G Outlook 2003 I need to move email to folder based on subject, using wild card Using Outlook 0
C In need of VBA code to read / parse HTML - Outlook emails Using Outlook 0
Similar threads


















































Top