Tech Tip Tuesday, Presidents' Day Edition –
Outlook tricks: Attachments Reminder
Ever send an email and intend to include an attachment and
totally forget? Don’t worry, now there’s a simple solution!
This macro is
designed to remind you to attach a document each time you mention the word
“attach” in any form (e.g., attachment, attached, etc) in an email if you have
not actually attached anything. It is very easy to set up (should you decide to
use it) and takes no more than a minute to insert.
NOTE: If
your email signature has a picture in it, this macro will treat that image as
an attachment and won’t work properly. However there’s a spot in the code you
can adjust to account for this, just read through the first section to see
instructions for adjusting the code.
To install:
1)
Open Outlook and hit Alt+F11 (or go to Tools>Macro>Visual Basic Editor)
2)
On the left you will see “Project 1,” expand it and following subfolders till
you see “ThisOutlookSession.” Double click on this and copy the following VB
Code into the editor: (EVERYTHING BETWEEN THE “=” BRACKETS)
====================================================
Private Sub
Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim m As Variant
Dim strBody As
String
Dim intIn As Long
Dim
intAttachCount As Integer, intStandardAttachCount As Integer
On Error GoTo
handleError
'Edit the
following line if you have a signature on your email that includes images or
other files. Make intStandardAttachCount equal the number of files in your
signature.
intStandardAttachCount
= 0
strBody =
LCase(Item.Body)
intIn = InStr(1,
strBody, "original message")
If intIn = 0 Then
intIn = Len(strBody)
intIn = InStr(1,
Left(strBody, intIn), "attach")
intAttachCount =
Item.Attachments.Count
If intIn > 0
And intAttachCount <= intStandardAttachCount Then
m = MsgBox("It appears that you meant to send an attachment," &
vbCrLf & "but there is no attachment to this message." &
vbCrLf & vbCrLf & "Do you still want to send this email?",
vbQuestion + vbYesNo + vbMsgBoxSetForeground)
If m = vbNo Then Cancel = True
End If
handleError:
If Err.Number
<> 0 Then
MsgBox "Outlook Attachment Reminder Error: " & Err.Description,
vbExclamation, "Outlook Attachment Reminder Error"
End If
‘-X
End Sub
====================================================
3)
Hit Save and close out of your VBA editor. You’re done!
No comments:
Post a Comment