Sort and then cut records to Cut records and then sort

T

Tony WONG

i have the following code to sort out the records into a text file.
********************
Set KKK = objfolder.Items
KKK.Sort "Start", False
For Each Item In KKK
If Item.Class = 26 Then
If Item.Start >= Now Or Item.End >= Now Then
With webfile
.writeline Item.Subject
End With
End If
End If
Next
********************
there are too many records in the folder now. i wish to change the code to
cut out the records first and then sort them in ascending order. i tried
out the following code but fail to item into items code. Could you give me
a hand or hints to do it? Thanks a lot.

above method : sort in ascending order first, and then cut the records out
of the date range.

below method : cut the records out of the date range, and then assign them
in a object, and then sort the items in the object in ascending order.

i think i have technical difficulties in assigned the new object at code ROW
5

**********************************
Set JJJ = objfolder.Items
For Each Item In objfolder.Items
If Item.Class = 26 Then
If Item.Start >= Now Or Item.End >= Now Then
JJJ.ItemAdd Item
End If
End If
Next
JJJ.Sort "Start", False
For Each Item In JJJ
With webfile
.writeline Item.Subject
End With
Next
*******************************
 
S

Sue Mosher [MVP-Outlook]

You might want to try using the Items.Restrict method to filter the items by date. See http://www.outlookcode.com/d/finddate.htm

Also note that ItemAdd is an event, not a method.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top