+ Reply to Thread
Results 1 to 3 of 3

Thread: Subject Line Alert - Outlook 2007

  1. #1
    Registered User
    Join Date
    08-28-2011
    Location
    St. Louis
    MS-Off Ver
    Excel 2007
    Posts
    19

    Subject Line Alert - Outlook 2007

    Is there a way to block and give an alert if sending an email if the subject line has a series of equal to or greater than 5 digits?
    Last edited by dreinisch; 09-12-2011 at 09:42 AM.

  2. #2
    Forum Guru mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2007/2010
    Posts
    3,005

    Re: Subject Line Alert - Outlook 2007

    Paste the following into the ThisOutlookSession tab in the VBA editor (Alt f11).

    Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
    Dim MySubject As String
    Dim N As Long
    MySubject = Item.Subject
    For N = 1 To Len(MySubject) - 4
        If IsNumeric(Mid(MySubject, N, 5)) = True And Len(Trim(Mid(MySubject, N, 5))) = 5 Then
            MsgBox "Subject contains at least 5 adjacent digits"
            Cancel = True
        End If
    Next N
    End Sub
    Martin

    Eighty Twenty Spreadsheet Automation http://homepage.ntlworld.com/martin.rice1/ for all your Excel customisation and consulting needs.

    If my solution has saved you time and/or money, please consider donating to Cancer Research UK.

  3. #3
    Registered User
    Join Date
    08-28-2011
    Location
    St. Louis
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Subject Line Alert - Outlook 2007

    Thank you! That worked like a charm!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.2.0