Need a rule for Outlook. Bonce back messages that have no subject line.

There is an employee here who refuses to put a subject line in her emails. She just leaves the subject line blank. That is very annoying. I need a rule or a macro or something that will take any email that I recieve that has a blank subject line and will delete the email and send back a message to the sender explaining why it was deleted. That way if she wants to email me she will be forced to put something in the subject line.

Or something similar to that.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David LeeCommented:
Hi xy8088,

Via a macro I can trap a blank subject line and delete the message.  Sending a response is a problem though.  Outlook's security model won't allow code to send a message without manual intervention.  Any attempt to send from code triggers a security dialog-box warning that a program is trying to send on your behalf and asking if you want to allow it to continue.  An alternative would be to build the response message, display it on screen, and allow you to click the Send button.

xy8088Author Commented:
I really don't need this anymore, but for future reference I'dd be interested in seeing how the macro would work, just to increase my own knowledge and skills in that area. So if you can create it and post it you'll get the points. I'd rather have the dialog box pop up that you described in the first part of your post. Thanks.
David LeeCommented:

Here's the code for doing this.  Follow these instructions to use it.  The code below will send a message back to the sender of any message arriving with a blank subject line.

1.  Start Outlook
2.  Click Tools->Macro->Visual Basic Editor
3.  If not already expanded, expand Microsoft Outlook Objects in the Project pane, then click on ThisOutlookSession
4.  Copy the script below
5.  Paste the script into the right-hand pane of the VB Editor
6.  Edit the code as desired
7.  Click the diskette icon on the toolbar to save the changes
8.  Close the VB Editor
9.  Click Tools->Macro->Security
10.  Set Security Level to Medium
11.  Close Outlook
12.  Start Outlook
13.  A dialog-box will appear telling you the ThisOutlookSession contains macros and asking if you want to enable them.  Say yes.
14.  Test the macro by sending yourself a message with a blank subject line.

Private Sub olkInboxItems_ItemAdd(ByVal Item As Object)
    Dim olkResponse As Outlook.MailItem
    If Item.Class = olMail Then
        If Item.Subject = "" Then
            Set olkResponse = Application.CreateItem(olMailItem)
            With olkResponse
                'Edit the subject as desired
                .Subject = "Message With Blank Subject"
                'Edit the message as desired
                .HTMLBody = "Your message with a blank subject line has been deleted without having been read.  " _
                    & "If you want me to read your messages, then please include a subject."
                .Recipients.Add Item.SenderEmailAddress
            End With
        End If
    End If
End Sub

Private Sub Application_Quit()
    Set olkInboxItems = Nothing
End Sub

Private Sub Application_Startup()
    Set olkInboxItems = Session.GetDefaultFolder(olFolderInbox).Items
End Sub

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
xy8088Author Commented:
Cool thanks! Probably won't get a chance to try it for a couple weeks though as we are in the middle of a big changeover/migration type thing.
David LeeCommented:
No problem.  Contact me if you run into any problems when you do get around to using it.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.