Sign in to follow this  
Followers 0
The World Is Yours

Outlook VBA Sort by Date

2 posts in this topic

I am building a code that does a search in a Outlook folder and put the body of the items together in just one item (to build a history for that case).

I am performing the search using the Find method (not sure if all correct). Once I get the search results, I'll put them in an array.

Is there a way to sort the array by date? I keep getting an error with code below:

Dim olApp As Outlook.Application
Dim olNs As Outlook.Namespace
Dim olFldr As Outlook.MAPIFolder
Dim olItms As Outlook.Items
Dim olMail As Variant
Dim MyArray() As String

Set olApp = New Outlook.Application
Set olNs = olApp.GetNamespace(?MAPI?)
Set olFldr = olNs.GetDefaultFolder(olFolderInbox)
Set olItms = olFldr.Items

Set olMail = olItms.Find("[Subject] = ""*140115LS*""")
If Not (olMail Is Nothing) Then

MyArray = olMail.Display

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.