PDA

View Full Version : Catch a word in Outlook subject



jiffyboy
05-13-2010, 05:42 AM
Our company has a method of converting our email to encrypted email when we put the word "Secure" in the subject line. Unfortunately, my department has begun using a transmission software called "Secure Transport". So any email that references the full name of the software gets encrypted, even though it does not contain sensitive information.

After the first dozen times or so of this happening, I've managed to remember to abbreviate "Secure" to "Sec". But now that we're rolling the software out to clients and partners, they're initiating email to me with the full word in the subject, so when I reply to them, guess what, it gets encrypted. This is both annoying to them and embarrassing to me.

I'm very conversant in Excel and Access vba, but Outlook not so much. Is there a way for Outlook to check the subject of an email before sending it for the presence of the word "secure" and allowing the user to cancel the send if the word is present? Thanks in advance.

-Dave

TonyJollans
05-14-2010, 05:27 AM
The easiest way is to put code in the Outlook Application_ItemSend Event. At its most basic, something like this would do the trick:

If InStr(UCase(Item.Subject), "SECURE") Then
If MsgBox("Mail will be encrypted. Continue?", vbYesNo) = vbNo Then Cancel = True
End If

jiffyboy
05-17-2010, 10:05 AM
That almost got it. I had to change the code to this:


If InStr(UCase(Item.Subject), "SECURE") >0 Then
If MsgBox("Mail will be encrypted. Continue?", vbYesNo) = vbNo Then Cancel = True
End If

Thanks!

TonyJollans
05-18-2010, 09:18 AM
Well done! Not sure how that got missed when I posted it.