Moving emails with similar subject and find the timings between the emails using outlook VBA macro

Status
Not open for further replies.

Lev

Member
Outlook version
Outlook 2016 64 bit
Email Account
Exchange Server
I want to move the emails from one folder to another folder based on the selection one of items in outlook. If i choose one email in outlook when i run the outlook VBA macro i want all similar subject of the email to be moved from that folder into another folder(we can sort by subject and move the email , this may be faster), also i want to calculate response time of first received email with same subject and the responded time of the email which i have replied at the last. Please assist
i have tried selecting one email and run the macro and it is moving to another folder correctly but i need all the similar subject of the has to be moved faster
Tried for moving one email by selecting the macro and it is working fine. but i want all the similar subject of the email has to be moved.I want to calculate the timing of the first email received and the email which i have responded at the latest.
Example subject of the email : Need data Received at 1 AM, i have acknowledged at 1 :10 AM and responded at 1:40 AM In that case i need to calculate the timings as 40 MIN

Sample VBA
Option Explicit

Sub MoveEml()
Dim ol As Outlook.Application
Dim ns As Outlook.NameSpace
Dim inFolder As Outlook.MAPIFolder
Dim olFolder As Outlook.MAPIFolder
Dim SubFolder As Outlook.MAPIFolder
Dim selItems As Selection
Dim myItem As Object
Dim SubItem As MailItems

Set ol = Outlook.Application
Set ns = ol.GetNamespace("MAPI")
Set inFolder = ol.Session.GetDefaultFolder(olFolderInbox)
Set olFolder = inFolder.Folders("Lyca")
Set SubFolder = inFolder.Folders("bakup")

' Set reference to the Selection.
Set selItems = ActiveExplorer.Selection
Set SubItem = selItems.Item.Subject
Debug.Print SubItem


' Loop through each item in the selection.
For Each myItem In selItems
myItem.Move SubFolder

Next

'MsgBox "All Done. Email converted to Plaintext.", vbOKOnly, "Message"

Set selItems = Nothing

End Sub
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
If you want to select one item and find all messages with that subject and mobed them, You'll need to grab the subject from the message then do a filter, or an if statement, and 'walk' the folder.
This would get the subject
Code:
Set objItem = ol.ActiveInspector.CurrentItem
strSubject = objItem.subject
If you want ot get the replied to time, you need to get the last verb value. I have a sample that checks for the replied to time and does something (you'll need to change what it does).
 
Status
Not open for further replies.
Thread starter Similar threads Forum Replies Date
J Outlook 2016 Moving IMAP emails to Exchange Using Outlook 1
D Any updates or fixes that would make this code stop working just moving emails to another folder Outlook VBA and Custom Forms 1
B Moving account, contacts & emails to another H/D with MSOutlook Using Outlook 5
D Moving Emails Based on Recipient/Sender Outlook VBA and Custom Forms 4
U Outlook 2010 'freezes' before moving emails Using Outlook 2
S Moving Emails Between Archive Folders Using Outlook 1
C Cant find emails after moving pst Using Outlook 1
H Moving emails in shared mailbox to personal mailbox Exchange Server Administration 0
M Moving multiple emails from draft folder to outbox Using Outlook 6
E Dowloading emails from live.com/hotmail.com to outlook, but without moving them, specially from the inbox to deleted mails Using Outlook 1
T Outlook 2007 crashes moving emails from inbox Using Outlook 1
C My emails disappear from Inbox without me moving or deleting them Using Outlook 16
J manually moving emails into the archive file Using Outlook 1
J Moving Imported folder Using Outlook 2
A .restrict results changing after moving to Exchange online Outlook VBA and Custom Forms 0
T I'm thinking about moving from outlook.com to the Outlook I have in my Office 365 Using Outlook 1
S Moving .OST file location unsuccessful! Using Outlook 6
M Moving mail to another folder is much slower than before (Office365) Using Outlook 0
M I'm Having problems Moving Contacts to a New List Using Outlook 8
P Moving Outlook.pst & archive1.pst Using Outlook 3
A Moving archived contents in Outlook 2007 back into working folders Using Outlook 0
Diane Poremsky Moving Deleted Items New Slipstick.com Articles 0
O Moving .ost file Using Outlook 12
Diane Poremsky Outlook.com is moving to Office 365! New Slipstick.com Articles 3
Diane Poremsky Check Contacts before moving them to Hotmail Contacts folder New Slipstick.com Articles 0
V Problem moving folders Using Outlook 4
Diane Poremsky Moving Outlook to a New Computer New Slipstick.com Articles 0
Diane Poremsky Moving from Outlook Express to Outlook New Slipstick.com Articles 0
M1ck53 Moving Outlook Using Outlook 9
Diane Poremsky Moving an Outlook offline data file (*.ost) New Slipstick.com Articles 3
D After Moving or Deleting Open Item - Meeting Requests Using Outlook 4
E Moving autoarchive settings to new computer (Outlook 2007) Using Outlook 1
Nick Truscott Lost custom forms after moving mailbox Outlook VBA and Custom Forms 3
L Moving Message Class email via script and Rule Outlook VBA and Custom Forms 3
R Moving contacts from ICloud back to Outlook 2010 Using Outlook 4
M which Outlook recommended to buy for moving Outlook 2000 versions Contact Data Using Outlook 2
P Moving PST file questions Using Outlook 3
Klaas "To Address" duplicated when moving msg to another folder Using Outlook 2
A Outlook 2013 EAS: moving message causes duplicates Using Outlook 3
C Moving BCM Database to Server Share BCM (Business Contact Manager) 1
A Moving .msg files back into outlook Using Outlook 2
S automatically moving flagged sent e-mail to a special folder Outlook VBA and Custom Forms 1
M moving custom field data between outlook and excel? Using Outlook 4
G Moving "Delete" button on Outlook for Mac Using Outlook 1
Commodore Message becomes "unread" after moving to a local folder Using Outlook 2
S Moving folders from outlook 2010 to a new computer with outlook 2013 Using Outlook 1
W Moving Exchange 2007 to a different drive/partition? Exchange Server Administration 1
A Outlook VBA - moving mail item to public folder using variable within path Using Outlook 6
O New to Outlook 2013, dealing with copying vs. moving sent items Using Outlook 0
O Moving OUtlook 2003 from bad XP to Win 7 Pro 64 -- URGENT! Using Outlook 8
Similar threads


















































Top