Help with macro to create folders for incoming emails

Pipner - Nov 18, 2015 at 05:14 PM
I have a situation where I get lots of emails on a daily basis with a subject line like the following

"Ticket Number # 1234567891: Subject"

The ticket number is always 10 digits long, and will sometimes have a : after it or a ,. It will always be in the format above with a # then a space then the 10 digit number.

I would like when I receive these emails for a new folder to be created in the following fashion.

Current Year> Current Month/Month of Email > Active > Ticket Number from subject of email

Basically there is already a folder called Tickets, this folder has yearly folders with monthly folders inside those, and each month has a folder for active tickets.

It would only have to create the current ticket folder, I can manually create the Month folder and Active folder if needed.

If the ticket folder already exists I would like it to move the email to the current folder. If no folder exists for that ticket number a new one should be created in the Active folder for that month and the email moved to it.

So the process would be as follows :

1) Email recieved Date 18/11/2015 Subject : Ticket Number #1234567891: New Ticket

2) Check for ticket folder in 2015>November>Active

3) If no ticket folder create folder 1234567891 in Active folder for November

4) Put email in new folder that was created.

Would anyone be able to help me with this macro and how I would go about adding it to Outlook to run automatically or on a button press?

I have attempted to adapt the code here but have not been successful. I am not sure where the code goes and how to adapt it to match my scenario.

I would be very grateful as this will save me an immense amount of time.