Before send criteria

Status
Not open for further replies.

VBA Noob

Member
Outlook version
Outlook 2007
Email Account
Exchange Server
Hi people,

I'm looking for a way to check before sending if an email has the word "attached" and if there is an attachment make sure it's an .xls extension. I found some code which kind of does this but it's only looking at general attachments and counts the auto signature.

VBA Noob
 

Forum Admin

Senior Member
So basically, you want to check for attachment keywords then check the attachments to see if any have xls extensions?
 

VBA Noob

Member
Outlook version
Outlook 2007
Email Account
Exchange Server
Correct. Should check for the key word in subject title and boby of text then check file extension is an excel format I guess either .xls or .xlsx

VBA Noob
 

Forum Admin

Senior Member
I'm not sure you can merge the macros - i'll have to take a look at them in the morning. (plus i asked some outlook developers for assistance - hopefully they will have a code sample.)
 

VBA Noob

Member
Outlook version
Outlook 2007
Email Account
Exchange Server
Hi Slipstick,

I think this works for me. I've managed to work out my Auto signature has a .png and .jpg attachement so use the below to work out how many of these items I've got e.g 2 and deduct from the
Code:
item.Attachments.Count
Code:
If item.Attachments.Count > 0 Then
   For i = 1 To item.Attachments.Count
       If item.Attachments(i).FileName Like "*PNG*" Or item.Attachments(i).FileName Like "*JPG*" Then
               Cnt = Cnt + 1
       End If
   Next i
VBA Noob
 
Status
Not open for further replies.
Top