mardi 30 septembre 2014

VBA Outlook item.find method not working on subject property


Vote count:

0




Please see the code below



Dim taskItems As Outlook.items, similarTaskItems As Outlook.items
Dim Item As Variant, similarItem As Variant, finalItem As Variant
Dim int_count As Integer
Dim str_tIsortProp As String
str_tIsortProp = "[CreationTime]"
Set taskItems = olToDoFldr.items

taskItems.Sort str_tIsortProp, OlSortOrder.olAscending

For Each Item In taskItems
Set similarTaskItems = taskItems.Find("[Subject]='" & Item.Subject & "'")

If similarTaskItems.Length > 1 Then
similarTaskItems.Sort str_tIsortProp, OlSortOrder.olAscending
For int_count = similarTaskItems.Length - 1 To 0 Step -1
If int_count = 0 Then
Set finalItem = similarTaskItems(int_count)
Else
If Not finalItem Is Nothing Then
finalItem.Body = finalItem.Body & vbCrLf & similarTaskItems(int_count).Body
similarTaskItems(int_count).Delete
End If
End If
Next
End If

Next Item


When I run this code the find method is suppose to return at least 1 item but it returns nothing. What am I missing?



asked 38 secs ago







VBA Outlook item.find method not working on subject property

Aucun commentaire:

Enregistrer un commentaire