Sometimes, you may forget to add required attachments to specific emails, such as emails to report your weekly works. This article will teach you to activate a popup warning to prevent you from sending the specific emails without attachments.
Unlike Outlook 2010 and previous versions, Outlook 2013 has a native support to remind you when you haven’t attached any files in the outgoing emails. You can enable this feature in Outlook Options like the following screenshot:
As long as you enable the automatic warning for missing attachments, every time when you send an email, a warning will pop up. But most of the time, you indeed don’t need to attach files. In such cases, the warning will be annoying. Here we will tell you how to enable an auto warning when no attachments in specific outgoing emails by means of Outlook VBA.
Auto Check for Attachments in Specific Outgoing Emails
- At the very outset, launch Outlook and switch to “Developer” tab.
- Click on the “Visual Basic” button in “Code” group.
- Then in the new popup “Microsoft Visual Basic for Applications” window, you should double click on “ThisOutlookSession” project to open it.
- Subsequently, you should copy the following codes into “ThisOutlookSession” project.
Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean) Dim strMsg As String Dim intAns As Integer If Item.Class <> olMail Then Exit Sub End If 'Specify the Email Recipient and Subject If InStr(LCase(Item.To), "test") > 0 And InStr(LCase(Item.Subject), "worklog") > 0 Then If Item.Attachments.Count = 0 Then strMsg = "Do you want to send the email without attachments?" intAns = MsgBox(strMsg, vbYesNo + vbDefaultButton2 + vbExclamation, "Check for Missing Attachments") If intAns = vbNo Then Cancel = True End If End If End If End Sub
- Next click the save icon in the toolbar.
- After that, you should proceed to sign this code.
- First, you should create a digital certificate. MS Office comes packed with a built-in utility – “Digital Certificate for VBA Projects”. You can find it out by searching “vba” in “Start Menu”.
- Next, go back to the “visual basic” window to sign the code.
- After that, exit the “Visual Basic” and click “Macro settings” button under the “Developer” tab. In the “Trust Center” dialog, you should select to only enable digitally signed macros. Remember to click “OK” lastly.
- Finally you can have a try. Create a new message with specific recipient and subject, but without attachments. When you click on “Send” button, you will receive a popup warning, shown as the following picture:
Keep Your Outlook Data Protected
Since that Outlook is prone to corruptions, you should make efforts to protect your Outlook data. The best way is to make a consistent and up-to-date backup. Hence, you can easily recover corrupted Outlook data from the backups even if suffers unexpected Outlook crash. Additionally, if the backup fail unfortunately, you have no choice but to take aid of an experienced repair tool, like 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 repair SQL db error and outlook repair software products. For more information visit www.datanumen.com