Consulting

Results 1 to 7 of 7

Thread: Before Send, Strip Text from Subject Line

  1. #1
    Site Admin
    The Princess
    VBAX Guru Anne Troy's Avatar
    Joined
    May 2004
    Location
    Arlington Heights, IL
    Posts
    2,530
    Location

    Before Send, Strip Text from Subject Line

    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??
    ~Anne Troy

  2. #2
    VBAX Tutor jamescol's Avatar
    Joined
    May 2004
    Location
    Charlotte, NC
    Posts
    251
    Location
    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

    [vba]
    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
    [/vba]
    "All that's necessary for evil to triumph is for good men to do nothing."

  3. #3
    Site Admin
    The Princess VBAX Guru Anne Troy's Avatar
    Joined
    May 2004
    Location
    Arlington Heights, IL
    Posts
    2,530
    Location
    Wow. Now if I could only find that Q... LOL! I'll look for it!
    ~Anne Troy

  4. #4
    VBAX Tutor jamescol's Avatar
    Joined
    May 2004
    Location
    Charlotte, NC
    Posts
    251
    Location
    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
    Quote Originally Posted by Dreamboat
    Wow. Now if I could only find that Q... LOL! I'll look for it!
    "All that's necessary for evil to triumph is for good men to do nothing."

  5. #5
    Site Admin
    The Princess VBAX Guru Anne Troy's Avatar
    Joined
    May 2004
    Location
    Arlington Heights, IL
    Posts
    2,530
    Location
    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!!

    ~Anne Troy

  6. #6
    Knowledge Base Approver VBAX Expert brettdj's Avatar
    Joined
    May 2004
    Location
    Melbourne
    Posts
    649
    Location
    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

  7. #7
    VBAX Tutor jamescol's Avatar
    Joined
    May 2004
    Location
    Charlotte, NC
    Posts
    251
    Location
    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
    "All that's necessary for evil to triumph is for good men to do nothing."

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •