View Single Post
  #1  
Old December 7th 07, 08:58 PM posted to microsoft.public.outlook.program_vba
Peter Marchert
external usenet poster
 
Posts: 116
Default How to create birthdays like Outlook does?

Hello,

I`m trying to create birthday appointments the same way like Outlook
does if you add a birthday in a contact. With this code I´m not able
to do so:

Sub CreateBirthday()

Dim objAppointment As Outlook.AppointmentItem
Dim objRecPattern As Outlook.RecurrencePattern

Set objAppointment =
Outlook.Session.GetDefaultFolder(olFolderCalendar) .Items.Add

With objAppointment
.ReminderSet = True
.Subject = "Test"
.AllDayEvent = True
.Start = CLng(27820) ' 3/1/1976
Set objRecPattern = .GetRecurrencePattern
objRecPattern.RecurrenceType = olRecursYearly
objRecPattern.PatternStartDate = CLng(27820)
objRecPattern.NoEndDate = True
.Save
End With

Set objRecPattern = Nothing
Set objAppointment = Nothing

End Sub

I expected a recurrence like:

End after:
End by: None

but I get a recurrence like this:

End after: 10
End by: Fri 3/1/1985

Is the used code wrong or does a workarround exists to get the same
result like Outlook?

I ask this question because my program creates birthday in that way
and a user have problems with the appointments after synchronizing
with his handy. May be it has to do with the way I create the items?

Btw: Setting the occurrences takes no effect
(objRecPattern.Occurrences = 1), it is still 10.

Thanks

Peter

--
Infos, workshops & software for
Outlook(R): www.outlook-stuff.com
Ads