• 0

Outlook VBA Sort by Date


Question

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

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

This topic is now closed to further replies.