No Attachment Warning - VBA Code HELP

Status
Not open for further replies.
F

fruitchunk

I had this code in Outlook 2003 it warned me when I sent email without

attachment if it found the word attached in the email.

It doesn't work in Outlook 2007, please help. Thanks.

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)

Dim lngres As Long

If InStr(1, Item.Body, "attach") <> 0 Then

If Item.Attachments.Count = 0 Then

lngres = MsgBox(" Found 'Attach' in message, but no attachment found - send

anyway?", _

vbYesNo + vbDefaultButton2 + vbQuestion, "You asked me to warn you...")

If lngres = vbNo Then Cancel = True

End If

End If

End Sub
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
See under Tools/Macro/Security whether VBA is allowed to be executed.

Best regards

Michael Bauer

Am Sun, 14 Mar 2010 08:07:01 -0700 schrieb fruitchunk:


> I had this code in Outlook 2003 it warned me when I sent email without
> attachment if it found the word attached in the email.

> It doesn't work in Outlook 2007, please help. Thanks.

> Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
> Dim lngres As Long
> If InStr(1, Item.Body, "attach") <> 0 Then
> If Item.Attachments.Count = 0 Then

> lngres = MsgBox(" Found 'Attach' in message, but no attachment found -


send
> anyway?", _

> vbYesNo + vbDefaultButton2 + vbQuestion, "You asked me to warn you...")

> If lngres = vbNo Then Cancel = True

> End If

> End If
> End Sub
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
A Warning When Opening attachment Using Outlook 7
F Outlook Attachment - warning to send specific type of file Using Outlook 2
T Missing attachment warning Outlook VBA and Custom Forms 1
A Edit attachment Save and Reply Outlook VBA and Custom Forms 0
D Move Email with Attachment to Folder Outlook VBA and Custom Forms 3
B Outlook 2010 Opening Mail Attachment Using Outlook 2
R Limiting length of saved attachment in VBA Outlook VBA and Custom Forms 2
F Script for zip file attachment Outlook VBA and Custom Forms 1
P Outlook 2013 Word Share doc as Email Attachment now brings up Eudora. Using Outlook 1
L Attachment saving and tracking - PLEASE help! Outlook VBA and Custom Forms 5
H Outlook 2003 find by "has attachment" Using Outlook 1
9 Outlook 2016 How to save an Outlook attachment to a specific folder then delete the email it came from? Using Outlook 1
J Add an Attachment Using an Array and Match first 17 Letters to Matching Template .oft to Send eMail Outlook VBA and Custom Forms 2
geofferyh Cannot get Macro to SAVE more than one message attachment??? Outlook VBA and Custom Forms 5
geofferyh How to change the Attachment File Name? Outlook VBA and Custom Forms 1
geofferyh Outlook 2010 How to Copy Outlook Attachment to a Specific Folder? Outlook VBA and Custom Forms 3
D Body text of email disappears when I scan an attachment from printer to email Using Outlook 1
J Help Please!!! Outlook 2016 - VBA Macro for replying with attachment in meeting invite Outlook VBA and Custom Forms 9
W Save Outlook attachment in network folder and rename to current date and time Outlook VBA and Custom Forms 18
D Autosave Attachment and Rename Outlook VBA and Custom Forms 1
N Macro for attachment saved and combine Outlook VBA and Custom Forms 1
Andrew Quirl Open attachment, manipulate without add-on program? Outlook VBA and Custom Forms 5
V VB script code to save a specific email attachment from a given email Outlook VBA and Custom Forms 14
Commodore Attachment icon when there is no attachment Using Outlook 3
V Saving attachment from outlook in My Documents Outlook VBA and Custom Forms 14
N automatic response with an attachment based on the subject line Outlook VBA and Custom Forms 1
J Auto Forward - Include Attachment and change Subject depending on original sender Outlook VBA and Custom Forms 3
M Search for attachment filename Using Outlook 0
E Open olNoteItem Attachment Outlook VBA and Custom Forms 6
Vijay Reply all by attachment name Using Outlook 10
Michael R Belleville Making an Attachment Name the Message Subject Using Outlook 2
N Paste content to Excel when .txt file (attachment) is opened Outlook VBA and Custom Forms 1
P Outlook Randomly Not attaching (attachment file) Using Outlook 0
S VBA to search a keyword in attachment and move to a folder Outlook VBA and Custom Forms 0
Diane Poremsky The Attachment Size Exceeds the Allowable Limit Error New Slipstick.com Articles 0
B VBA Help Email that will save as draft and send as attachment Outlook VBA and Custom Forms 3
O Maker Checker - Colleague to authorise attachment Using Outlook 0
C Outlook Attachment List in Reply Header Using Outlook 3
B Auto Preview Attachment in Inspector Reading Pane Outlook VBA and Custom Forms 1
Randy Redekopp Outlook 2016 attachment content search Outlook VBA and Custom Forms 2
A OL16 C2R attachment preview fails Using Outlook 8
R Print email message and attachment in order Outlook VBA and Custom Forms 2
RalphG101 No indication of attachment, when selecting file, send to outlook. Using Outlook 0
A Auto Insert of filename when selecting 'Remove Attachment' Using Outlook 1
A "untitled attachment" if file name contains eg. special character Using Outlook 1
Mark Foley Emailing attachment from Word/Excel sends attachment but no message body Using Outlook 0
peacepanda How to save attachment looking at the attachment name Outlook VBA and Custom Forms 1
Diane Poremsky Add Attachment Names to Message Before Sending New Slipstick.com Articles 0
K Outlook send emails without attachment to a list Using Outlook 1
A Check for attachment code not working Outlook VBA and Custom Forms 1

Similar threads

Top