PDA

View Full Version : Attachment Verification



dmuzial
07-01-2011, 08:22 AM
Hey Everyone!

So I'm horrible with making sure that I have attached documents to my emails, so a friend passed on the following code so I can set up that verification.

Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
If Item.Attachments.Count = 0 And InStr(1, Item.Body, "attach", vbTextCompare) Then
If MsgBox("It appears that an item should be attached" + vbLf + "to this message, but no item is attached." + vbLf + vbLf + "Do you still want to send this message?", vbYesNo, "Continue sending?") = vbNo Then
Cancel = True
End If
End If
End Sub

I ran through it and from what I can tell, everything looks right. But whenever I try to set it up, it won't pop up under my macros tab.

Did I type something incorrectly?

Charlize
07-04-2011, 05:03 AM
MsgBox Item.Attachments.Count
If Item.Attachments.Count = 0 And InStr(1, Item.Body, "attach") > 0 Then
If MsgBox("It appears that an item should be attached" + vbLf + _
"to this message, but no item is attached." + vbLf + vbLf + _
"Do you still want to send this message?", vbYesNo, _
"Continue sending?") = vbNo Then
Cancel = True
Exit Sub
End If
End If
But if you are using a picture in your signature, you'll have to alter the 0 to 1 . Picture is counted as an attachment for some reason.

Charlize