Link to home
Start Free TrialLog in
Avatar of nschwend
nschwend

asked on

outlook macro that parses subjects of a mail folder and sends a daily report

Hello all,
following this fantastic macro
https://www.experts-exchange.com/questions/28634016/outlook-macro-that-parses-subjects-of-all-emails-present-in-a-folder.html
I wish to create another macro that parses the daily received emails subject and sends an email with report with how many email with the same subject I received during the last day (or the current day if it's easier).
do you know how to that?
thank you very much
best regards
Nick
Avatar of Helen Feddema
Helen Feddema
Flag of United States of America image

This can certainly be done (using Outlook VBA -- not VBScript, which is only needed for code on Outlook forms).  A few questions:

1.  How do you define "daily received emails"?  Are they gathered together into a specific folder, for example?
2.  Does "the same subject" mean a specific subject (if so, what is it?) or do you want counts of the number of emails for each subject?
3.  What is the email to which the report should be sent?
4.  What format is the report -- plain text in body of email, HTML text in body of email, an attached text file, or something else?
Avatar of nschwend
nschwend

ASKER

Hi Helen,
sorry for the delay....
I try to answer as clearer as possible:
1. I've a folder with Archived_Alerts where arrives all the archived issues from the monitoring system. I wish the code looks at this folder for the report
2.  the monitor system normally send an email with a subject like this when there is a problem:
Check Last Transcoded - PROBLEM
and a subject like this when the problem has been solved
Check Last Transcoded - OK
3. I wish that the report email counts how many email I received in this folder the last day and (if possible) how much for each type of issue
4. this is completely indifferent. I use it as an internal report to have a global summary.

hope it helps.
thank you very much
best regards
Nick
Do you have a list of the problem types?  That would make it easier to check for the number of each type.
It's a long list (almost 70 types of different subjects)... Should be more interesting to be dinamically created....
Thank you!
Nick
OK, will see if I can create a sample procedure later today.
thank you very much Helen... Really appreciate!
regards
Nick
I have the procedure done except for the part that counts the number of messages per subject.  This would be much easier to do in Access than in Outlook -- is that a possibility?  If not, I can save the subjects as Outlook NoteItems.  In that case, could they be saved in the default Notes folder?
ASKER CERTIFIED SOLUTION
Avatar of Helen Feddema
Helen Feddema
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi Helen,
first of all THANK YOU for your time and the code you provided...
I think you let something that parses the notes instead of the mailbox folder... it takes the only note I have...

I've a stupid question: How can I do to execute it at midnight?
thank you a lot!
best regards
Nick
The code parses the mail messages in the folder you select, and then saves the subjects for the selected day as notes.  Then it parses the notes and counts how many messages there are for each subject (ritms is a collection of mail messages for the selected date, and ritms2 is a collection of mail messages with the current subject).

To execute it at midnight, it would have to be converted into a VBScript and run from the Windows Scheduler.  I am not sure that all the VBA code could be translated into VBScript, which is a more limited dialect of VB.  Or (if you have Access), it might be possible to convert the code into Access VBA (only minor modifications would be needed), then run it from an Access macro, which could be called from a VBScript.  Let me know if that would work.

Perhaps there is no need to run it exactly at midnight.  It processes a certain day's messages only, so it doesn't really matter when it is run.
Hi Helen
I did some small changes and now works perfectly.
following this link http://www.vboffice.net/en/developers/send-emails-automatically/ I also created a task to send it automatically.
kind regards and thank you very much!!!!
NIck