0

Everyday, I receives nearly 100+ emails which contain the following.

CRM Status: Open
CRM Interaction Number: XXXXX

On some emails Status and Number are missing.
Example:

CRM Status: 
CRM Interaction Number: 

I need to look manually and categorize as "Not Ticketed".

Is there a way to find how many emails don't have the Ticket# and Status.

Community
  • 1
  • 1
rocky09
  • 113
  • 1
  • 11
  • 1
    Yes you can loop through the Body of the Email and find the String using VBA. [Might Give you an Start](https://stackoverflow.com/questions/31265985/loop-though-body-only-of-an-email) – Mikku Jul 24 '19 at 07:18
  • Try to find what is between the : and vbNewLine. https://stackoverflow.com/questions/31717844/find-carriage-return-in-a-mail-body and https://stackoverflow.com/questions/20001670/vba-outlook-body-string-search – niton Jul 24 '19 at 12:16

1 Answers1

1

Is there a way that a VBA can use to find out how many emails doesn't have the Ticket# and Status.

The Outlook object model provides the Find/FindNext and Restrict methods of the Items class. You can read more about these methods in the following articles:

How To: Use Find and FindNext methods to retrieve Outlook mail items from a folder (C#, VB.NET)

How To: Use Restrict method to retrieve Outlook mail items from a folder

Also, you may find the AdvancedSearch method of the Application class helpful.

The key benefits of using the AdvancedSearch method in Outlook are:

  • The search is performed in another thread. You don’t need to run another thread manually since the AdvancedSearch method runs it automatically in the background.
  • Possibility to search for any item types: mail, appointment, calendar, notes etc. in any location, i.e. beyond the scope of a certain folder. The Restrict and Find/FindNext methods can be applied to a particular Items collection (see the Items property of the Folder class in Outlook).
  • Full support for DASL queries (custom properties can be used for searching too). You can read more about this in the Filtering article in MSDN. To improve the search performance, Instant Search keywords can be used if Instant Search is enabled for the store (see the IsInstantSearchEnabled property of the Store class).
  • You can stop the search process at any moment using the Stop method of the Search class.

Read more about this method in the Advanced search in Outlook programmatically: C#, VB.NET article.

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45