PDA

View Full Version : Before Send, Strip Text from Subject Line



Anne Troy
09-03-2004, 02:32 PM
In Internet Explorer, if you hit File-Send-Link by Email, Outlook 2003 puts "emailing: " preceded by the name of the html file into the subject line.

Could we somehow get it NOT to do that? Such as an Email_Before_Send (LOL) macro that will strip that phrase out of there?

JamesCol?? :)

jamescol
09-13-2004, 11:00 PM
This code should do the trick. Unfortunately, there is no good method for testing this type of message, except for checking the subject line. A small performance boost is that the code only checks MailItems, not Appopintments, Tasks, etc. If your situation requires checking other olItems, just remove the "myItem.Class = olMail And " from the IF statement.

To trap the ItemSend event, you need to:
1. Place this code in the "ThisOutlookSession" module
2. Ensure Outlook's macro security is set to Medium or below

Let me know if you have questions or if something isn't clear.

Cheers,
James


Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim lnNumOfChars As Long
Dim myItem As MailItem
lnNumOfChars = 10
Set myItem = Item


If myItem.Class = olMail And Left(myItem.Subject, lnNumOfChars) = "Emailing: " Then
myItem.Subject = Mid(myItem.Subject, lnNumOfChars + 1)

End If

End Sub

Anne Troy
09-14-2004, 11:54 AM
Wow. Now if I could only find that Q... LOL! I'll look for it!

jamescol
09-14-2004, 12:59 PM
I've been up for a couple of days now, so maybe I'm just too tired :) But I don't get it :(

Cheers,
James

Wow. Now if I could only find that Q... LOL! I'll look for it!

Anne Troy
09-14-2004, 01:21 PM
I'm sorry, James. Someone asked a Q at a forum where, since they upgraded, when they hit File-Send to it now precedes the subject line with "Emailing: " instead of just the file name, which apparently was all the older version put in the subject line. They also apparently sorted their sent items by file name or something, because they hated this new *feecher*.

So, I'm trying to find the Q that was asked, and can't at the moment. I'll keep looking tho!!

:)

brettdj
09-14-2004, 06:53 PM
James,

This Outlook VBA wannabe hunted around for a while trying to capture the new message event so the title could be edited before the message was sent. I thought that maybe the Inspector could grab it

But apparently File - Send doesn't trigger the Inspector. Grrrr

Cheers

Dave

jamescol
09-15-2004, 05:48 AM
Dave,
You are correct. When using File |Send As Mail from Windows Explorer, IE, or any other app, Windows is simply using a registry key to send the message via the default mail client. The way this message gets handed to Outlook doesn't trigger the inspector event at all.

There is a way to replace the registry entry (unsupported, though) to work around that issue. It's messy, though.

Cheers,
James