How to Auto Flag Incoming Emails with Specific Attachments in Your Outlook

When receiving a new email with specific attachments, if you are used to manually flagging it for follow up, why don’t you directly let your Outlook to auto flag it? This article will guide you to achieve this feature.

When it comes to auto flagging incoming emails, perhaps you will think of using Outlook rules in the first place. Outlook does provide such a rule action. But, if you want to auto flag incoming emails with specific attachments, Outlook rule is unable to help you in that it does not offer a rule condition to check attachment. Hence, to realize it, you have to combine rule with a bit of scripting. Here, in the followings, we will teach you to get it step by step.

Auto Flag Incoming Emails with Specific Attachments

  1. For a start, in Outlook, press “Alt + F11” key buttons.
  2. Then, in the new window, put the following VBA code into a module.
Sub FlagEmail_SpecificAttachments(objMail As Outlook.MailItem)
    Dim objAttachment As Outlook.Attachment
    If objMail.Attachments.Count > 0 Then
       For Each objAttachment In objMail.Attachments
           'Check if the email contains specific attachment
           'You can change the criteria as per your needs
           Select Case Right(LCase(objAttachment.FileName), 4)
                  'Check attachment file type
                  Case ".xls", "xlsx"
                       'Check attachment file name
                       If InStr(objAttachment.FileName, "Report") > 0 Then
                          'Flag the email due to Tomorrow
                          With objMail
                               .MarkAsTask olMarkTomorrow
                               .ReminderSet = True
                               .ReminderTime = Now + 1
                          End With
                       End If
         End Select
         Exit For
    End If
End Sub

VBA Code - Auto Flag Incoming Emails with Specific Attachments

  1. Subsequently, exit the VBA editor.
  2. After that, go to “File” menu and click “Manage Rules & Alerts” button.
  3. Next, in the popup dialog box, click “New Rule”.
  4. Later, in “Rules Wizard” dialog box, select “Apply rule on messages I receive” and click “Next”.Apply rule on messages I receive
  5. In the new screen, select conditions as per your needs and hit “Next”.
  6. Afterwards, in “Select actions”, choose “Run a script”.
  7. Then, select the “FlagEmail_SpecificAttachments” script.Run Script in Rule
  8. Next, just follow the onscreen instructions to complete the rule setup.
  9. After creating such a rule successfully, from now on, every time when a new email with specific attachment attached arrives in your mailbox, Outlook will auto flag this email for follow-up, as shown in the following figure.Auto Flag Incoming Emails with Specific Attachments

Deal with Outlook Damage

Among all kinds of Outlook issues, undoubtedly, Outlook corruption is the most terrible one. It is because that when encountering it, you have to repair damaged Outlook file to your utmost. However, as we all know, it is indeed an arduous task. Maybe you will firstly try the inbox repair tool. Yet, in honesty, most of time, it’ll not make effects in such cases. Thereby, your last resort is to resort to a powerful and trustworthy external tool, such as DataNumen Outlook Repair.

Author Introduction:

Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including damaged mdf and outlook repair software products. For more information visit

Comments are closed.