How I used VBA to filter spam, Part 1

Part 1, 2

Your first question probably is either why did you do this, or what the heck is VBA? Both are goods questions and I will answer neither. I am just kidding.

VBA is an acronym for Visual Basic for Applications.  Wikipedia has a solid overview about it. It is part of the Microsoft Office Suite. I have the suite and use Outlook to check my email. One day I started to receive spam and like a normal user I made a rule to block it but that did not work. The evil genius who created this spam did his or her homework. My email tool could not filter it properly.


Here comes the why and how I used VBA. First, I looked at the contents of the message and found a pattern. Eureka, I can now fight this spam, but alas, Outlook’s rules do not filter on regular expressions (or patterns). What shall I do, I asked myself.  The next step was to Google, using regular expressions in Outlook.  I found some options, but most seemed like overkill for what I wanted to accomplish. Then, I remembered, VBA can solve my spam problems.  let me try it.

In the next part of this series, I will go into detail on how I successfully squashed the spam. I also will post the code for my solution.


Be Sociable, Share!

Leave a Reply