• Outlook User
  • New Outlook app
  • Outlook.com
  • Outlook Mac
  • Outlook & iCloud
  • Developer
  • Microsoft 365 Admin
    • Common Problems
    • Microsoft 365
    • Outlook BCM
    • Utilities & Addins

Forward Messages that were not Replied To

Slipstick Systems

› Developer › Code Samples › Forward Messages that were not Replied To

Last reviewed on December 4, 2018     12 Comments

An Outlook user wanted to forward messages that were not replied to within a specific period of time. If the messages were still unreplied to later, he wanted to forward them to a different address.

To do this you need to check the last verb property (PR_LAST_VERB_EXECUTED) using propertyaccessor. If the last verb is not 102 (reply) or reply all (103) then check the received date. If it's older than 7 days then forward to address1; if older than 3 days, forward to address2. (By checking for older messages first, we avoid forwarding the same message to address2 a second time.)

More propertyaccessors for email can be found at Read MAPI properties not exposed in Outlook's Object Model

This macro runs only when you run it, but you could use the method described at Send an email when an Appointment reminder fires to trigger it using a reminder.

To change the folder the macro checks, see Working with VBA and non-default Outlook Folders. As written it checks the default Inbox but it can check in any folder, including a shared mailbox's Inbox.

Sub ForwardAgedMail()
    Dim objOutlook As Outlook.Application
    Dim objNamespace As Outlook.NameSpace
    Dim objSourceFolder As Outlook.MAPIFolder
    Dim objVariant As Variant
    Dim intCount As Integer
    Dim intDateDiff As Integer
    Dim propertyAccessor As Outlook.propertyAccessor
    Dim myForward As Outlook.MailItem
    
 'On Error Resume Next
    Set objOutlook = Application
    Set objNamespace = objOutlook.GetNamespace("MAPI")
    Set objSourceFolder = objNamespace.GetDefaultFolder(olFolderInbox)
     
    ' use a subfolder under Inbox
 
    For intCount = objSourceFolder.Items.Count To 1 Step -1
        Set objVariant = objSourceFolder.Items.Item(intCount)
        DoEvents
        If objVariant.Class = olMail Then
            
         Set propertyAccessor = objVariant.propertyAccessor
            If Not propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x10810003") = 102 _
            And Not propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x10810003") = 103 Then
            
              intDateDiff = DateDiff("d", objVariant.SentOn, Now)
              
            ' I'm using 7 days, adjust as needed.
            If intDateDiff > 7 Then
                'forward message
            
            Set myForward = objVariant.Forward
            myForward.To = "alias1@domain.com"
            myForward.Display
 
            ElseIf intDateDiff > 3 Then
            
            Set myForward = objVariant.Forward
            myForward.To = "alias2@domain.com"
            myForward.Display ' .send
 
            End If
            
            End If
        End If
    Next
     
End Sub

Don't count weekends

Removing weekends (or holidays) from the count is more difficult. If the date span is 5 business days, this snippet should work. It checks the sent date and adds 2 to account for the weekend days.

Dim sentDate As Date
sentDate = objVariant.SentOn

Select Case Weekday(sentDate, vbUseSystemDayOfWeek)
  Case vbSunday
    sentDate = DateAdd("d", 1, sentDate)
  Case vbSaturday
    sentDate = DateAdd("d", 2, sentDate)
  Case vbFriday
    sentDate = DateAdd("d", 2, sentDate)
  Case vbThursday
    sentDate = DateAdd("d", 2, sentDate)  
  Case vbWednesday
    sentDate = DateAdd("d", 2, sentDate)  
  Case vbTuesday
    sentDate = DateAdd("d", 2, sentDate)
  Case vbMonday
    sentDate = DateAdd("d", 2, sentDate)
End Select

  intDateDiff = DateDiff("d", sentDate, Now)

How to use macros

First: You will need macro security set to low during testing.

To check your macro security in Outlook 2010 or 2013, go to File, Options, Trust Center and open Trust Center Settings, and change the Macro Settings. In Outlook 2007 and older, it’s at Tools, Macro Security.

After you test the macro and see that it works, you can either leave macro security set to low or sign the macro.

Open the VBA Editor by pressing Alt+F11 on your keyboard.

To put the code in a module:

  1. Right click on Project1 and choose Insert > Module
  2. Copy and paste the macro into the new module.

More information as well as screenshots are at How to use the VBA Editor

More Information

To view the last verb and last verb executed time in your email folders, see How to display the sender's email address in Outlook.
This macro is based off of the macro at Use a Macro to Move Aged Email in Outlook
DateDiff Function (Visual Basic) (MSDN)

Forward Messages that were not Replied To was last modified: December 4th, 2018 by Diane Poremsky

Related Posts:

  • Macro to Move Aged Email Messages
  • Macro to file Outlook email by sender's display name
  • Empty Multiple Deleted Items Folders using a Macro
  • Set an expiration date on all messages you send

About Diane Poremsky

A Microsoft Outlook Most Valuable Professional (MVP) since 1999, Diane is the author of several books, including Outlook 2013 Absolute Beginners Book. She also created video training CDs and online training classes for Microsoft Outlook. You can find her helping people online in Outlook Forums as well as in the Microsoft Answers and TechNet forums.

Subscribe
Notify of
12 Comments
newest
oldest most voted
Inline Feedbacks
View all comments

Amir Hodzic
March 24, 2020 3:07 pm

Hi Diane,

I'm using your example to collect all emails which I have sent to other recipients without them replying, into a separate folder. I manage to do that, however the emails in my new folder are only a handfull of the ones sent. I only see some mails which I've sent to myself or to my other email and other that were auto-generated from SharePoint on my behalf.
Is it even possible to use the NOTEIVERB_REPLYTOSENDER or NOTEIVERB_REPLYTOALL property to accomplish this?

0
0
Reply
marius
September 29, 2015 3:45 am

Hi, i have your code for copy older emails and i added 2 if statements to check for sender address and subject but it doesn't work. Any help is welcomed. Thank you.

For intCount = objSourceFolder.Items.Count To 1 Step -1
Set objVariant = objSourceFolder.Items.Item(intCount)
DoEvents

If objVariant.Class = olMail Then

If objVariant.SenderAddress = "Alin@yahoo.com" Then

If objVariant.Subject = "Client update" Then

Set propertyAccessor = objVariant.propertyAccessor
If Not propertyAccessor.GetProperty("https://schemas.microsoft.com/mapi/proptag/0x10810003") = 102 _
And Not propertyAccessor.GetProperty("https://schemas.microsoft.com/mapi/proptag/0x10810003") = 103 Then
intDateDiff = DateDiff("d", objVariant.SentOn, Now)
Set objDestFolder = objNamespace.Folders("Mailbox - Marius").Folders("Inbox").Folders("zile arhivare").Folders("Ieri")
If intDateDiff > -1 Then
Set Copy = objVariant.Copy
Copy.MOVE objDestFolder
End If
End If
End If
End If
End If

0
0
Reply
Robert
September 3, 2015 6:00 pm

This works almost exactly the way I need, however, is there a way to forward messages from a specific sender that were not replied to. For example, anytime I receive a message from A@A.com and i do not reply within 3 days it forwards the message, but if I receive a message from B@A.com it does nothing?
Thank you so much for your help.

0
0
Reply
Diane Poremsky
Author
Reply to  Robert
September 3, 2015 8:05 pm

You can use an if statement after checking for the olmail type -
If objVariant.Class = olMail Then
If objvariant.senderaddress <> "a@a.com" then
exit sub
end if

0
0
Reply
marius
September 3, 2015 9:26 am

hi, it worked until now and now it gives me an error at : For intCount = objSourceFolder.Items.Count To 1 Step -1 .eny help is wolcomed. thank you.

0
0
Reply
marius
September 3, 2015 7:59 am

Hi, i made it :D ( thank you verry much ) . But if you will allow, i want to ask you if there is an way to search in a shared folder an email with the subject from an excel. the ideea is that i have some 200 names in an excel and i must manually search in an shared folder for email with the client name in the subject. Is there a way to make the search automatic and warn me if i have emails for a client name. Thank you.

0
0
Reply
marius
September 3, 2015 3:23 am

Hi how can i make this code to search in a shared inbox for those email that were not replied to? Now it searches in the personal inbox and i want to search in an office shared inbox. any help is welcomed. Thank you.

0
0
Reply
Diane Poremsky
Author
Reply to  marius
September 3, 2015 7:48 am

This tells it to look in the default inbox:
Set objSourceFolder = objNamespace.GetDefaultFolder(olFolderInbox)
replace it with this:
Set objSourceFolder = GetFolderPath("Shared mailbox name\Inbox")
and get the GetFolderpath function at https://www.slipstick.com/developer/code-samples/use-macro-assign-messages-shared-mailbox/#getfolderpath

0
0
Reply
Dan
April 26, 2015 11:35 pm

Dear Diana,
Thanks for the response. How about being use of combination of ConversationIndex and ConversationID?

0
0
Reply
Diane Poremsky
Author
Reply to  Dan
April 27, 2015 12:28 am

It could work, but not all mail clients/servers leave the conversation id in place. Adding a guid to the message body and searching on it would also work - when messages arrive, a macro looks for the guid and clears the matching flag or deletes the task. You could remove the guid from the body when a match is found so the macro won't keep searching for a match as this can slow outlook down if you are sending 200 messages a day.

0
0
Reply
Dan
April 25, 2015 6:29 am

Dear Diana,

I have another question – sent on average about 100 to 200 messages / emails on daily basis. What I need is that an email / message sent from my account, if un-replied by recipient after two days after being sent, will be re-sent again with addition of a sentence such as reminder. How is that possible to be achieved?

0
0
Reply
Diane Poremsky
Author
Reply to  Dan
April 25, 2015 11:59 pm

Checking for replies to messages you sent is more difficult and I don't have any code samples that can do it. It think Sperry software has a utility that monitors for replies and notifies you - i don't know if it can send a reminder to the recipient.

0
0
Reply

Visit Slipstick Forums.
What's New at Slipstick.com

Latest EMO: Vol. 30 Issue 32

Subscribe to Exchange Messaging Outlook






Support Services

Do you need help setting up Outlook, moving your email to a new computer, migrating or configuring Office 365, or just need some one-on-one assistance?

Our Sponsors

CompanionLink
ReliefJet
  • Popular
  • Latest
  • Week Month All
  • Jetpack plugin with Stats module needs to be enabled.
  • Move Deleted Items to Another Folder Automatically
  • Open Outlook Templates using PowerShell
  • Count and List Folders in Classic Outlook
  • Google Workspace and Outlook with POP Mail
  • Import EML Files into New Outlook
  • Opening PST files in New Outlook
  • New Outlook: Show To, CC, BCC in Replies
  • Insert Word Document into Email using VBA
  • Delete Empty Folders using PowerShell
  • Warn Before Deleting a Contact
Ajax spinner

Recent Bugs List

Microsoft keeps a running list of issues affecting recently released updates at Fixes or workarounds for recent issues in classic Outlook (Windows).

For new Outlook for Windows: Fixes or workarounds for recent issues in new Outlook for Windows .

Outlook for Mac Recent issues: Fixes or workarounds for recent issues in Outlook for Mac

Outlook.com Recent issues: Fixes or workarounds for recent issues on Outlook.com

Office Update History

Update history for supported Office versions is at Update history for Office

Outlook Suggestions and Feedback

Outlook Feedback covers Outlook as an email client, including Outlook Android, iOS, Mac, and Windows clients, as well as the browser extension (PWA) and Outlook on the web.

Outlook (new) Feedback. Use this for feedback and suggestions for Outlook (new).

Use Outlook.com Feedback for suggestions or feedback about Outlook.com accounts.

Other Microsoft 365 applications and services




New Outlook Articles

Move Deleted Items to Another Folder Automatically

Open Outlook Templates using PowerShell

Count and List Folders in Classic Outlook

Google Workspace and Outlook with POP Mail

Import EML Files into New Outlook

Opening PST files in New Outlook

New Outlook: Show To, CC, BCC in Replies

Insert Word Document into Email using VBA

Delete Empty Folders using PowerShell

Warn Before Deleting a Contact

Newest Code Samples

Open Outlook Templates using PowerShell

Count and List Folders in Classic Outlook

Insert Word Document into Email using VBA

Warn Before Deleting a Contact

Use PowerShell to Delete Attachments

Remove RE:, FWD:, and Other Prefixes from Subject Line

Change the Mailing Address Using PowerShell

Categorize @Mentioned Messages

Send an Email When You Open Outlook

Delete Old Calendar Events using VBA

VBA Basics

How to use the VBA Editor

Work with open item or selected item

Working with All Items in a Folder or Selected Items

VBA and non-default Outlook Folders

Backup and save your Outlook VBA macros

Get text using Left, Right, Mid, Len, InStr

Using Arrays in Outlook macros

Use RegEx to extract message text

Paste clipboard contents

Windows Folder Picker

Custom Forms

Designing Microsoft Outlook Forms

Set a custom form as default

Developer Resources

Developer Resources

Developer Tools

VBOffice.net samples

SlovakTech.com

Outlook MVP David Lee

Repair PST

Convert an OST to PST

Repair damaged PST file

Repair large PST File

Remove password from PST

Merge Two Data Files

Sync & Share Outlook Data

  • Share Calendar & Contacts
  • Synchronize two computers
  • Sync Calendar and Contacts Using Outlook.com
  • Sync Outlook & Android Devices
  • Sync Google Calendar with Outlook
  • Access Folders in Other Users Mailboxes

Diane Poremsky [Outlook MVP]

Make a donation

Mail Tools

Sending and Retrieval Tools

Mass Mail Tools

Compose Tools

Duplicate Remover Tools

Mail Tools for Outlook

Online Services

Calendar Tools

Schedule Management

Calendar Printing Tools

Calendar Reminder Tools

Calendar Dates & Data

Time and Billing Tools

Meeting Productivity Tools

Duplicate Remover Tools

Productivity

Productivity Tools

Automatic Message Processing Tools

Special Function Automatic Processing Tools

Housekeeping and Message Management

Task Tools

Project and Business Management Tools

Choosing the Folder to Save a Sent Message In

Run Rules on messages after reading

Help & Suggestions

Submit Outlook Feature Requests

Slipstick Support Services

Buy Microsoft 365 Office Software and Services

Visit Slipstick Forums.

What's New at Slipstick.com

Home | Outlook User | Exchange Administrator | Office 365 | Outlook.com | Outlook Developer
Outlook for Mac | Common Problems | Utilities & Addins | Tutorials
Outlook & iCloud Issues | Outlook Apps
EMO Archives | About Slipstick | Slipstick Forums
Submit New or Updated Outlook and Exchange Server Utilities

Send comments using our Feedback page
Copyright © 2025 Slipstick Systems. All rights reserved.
Slipstick Systems is not affiliated with Microsoft Corporation.

:wpds_smile::wpds_grin::wpds_wink::wpds_mrgreen::wpds_neutral::wpds_twisted::wpds_arrow::wpds_shock::wpds_unamused::wpds_cool::wpds_evil::wpds_oops::wpds_razz::wpds_roll::wpds_cry::wpds_eek::wpds_lol::wpds_mad::wpds_sad::wpds_exclamation::wpds_question::wpds_idea::wpds_hmm::wpds_beg::wpds_whew::wpds_chuckle::wpds_silly::wpds_envy::wpds_shutmouth:
wpDiscuz

Sign up for Exchange Messaging Outlook

Our weekly Outlook & Exchange newsletter (bi-weekly during the summer)






Please note: If you subscribed to Exchange Messaging Outlook before August 2019, please re-subscribe.

Never see this message again.

You are going to send email to

Move Comment