Calendar items without dates?

J

Jeff Mowatt

I'm finding that when attempting to sort and list reccurences of an
appointment the first item seems to be blank or unreadable. I can show with
the script below that my counter is displayed without a date corresponding
to it, every time this code is executed.

I've attempted to skip over it as it seems superfluous but inserting a
FindNext at the begining of the loop doesn't have any effect at all.

Can anyone tell me what's happening?

TiA

Jeff Mowatt

sub showdates()
on error resume next
erase adates
set myFolder = Application.ActiveExplorer.CurrentFolder
set oColl = myfolder.items
oColl.IncludeRecurrences = true
oColl.Sort("[start]")
cstart=item.start
cid=item.entryid
csubject=item.subject
set mymessage = oColl.Find("[start] >= '"&cstart&"'")
mycounter = 0
redim adates(99)
do until mymessage is nothing
if mymessage.entryid = cid then
if mymessage.start >= cstart then
if mymessage.subject = csubject then
msgbox mymessage.start
msgbox mycounter
mycounter=mycounter+1
end if
end if
end if
set mymessage= ocoll.findnext()
loop
end sub
 
S

Sue Mosher [MVP]

Try reversing the order of statements. Sort needs to come first:

oColl.Sort "[Start]"
oColl.IncludeRecurrences = true

Also, you need to take care to eliminate the seconds component from the date string. See http://www.slipstick.com/dev/finddate.htm
--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
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

Similar Threads


Top