A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

How to create birthdays like Outlook does?



 
 
Thread Tools Search this Thread Display Modes
  #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
  #2  
Old December 7th 07, 09:54 PM posted to microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 830
Default How to create birthdays like Outlook does?

Your code works prefectly fine on Outlook 2007 - weird.

--
Eric Legault - Outlook MVP, MCDBA, MCTS (SharePoint programming, etc.)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"Peter Marchert" wrote:

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

  #3  
Old December 7th 07, 11:06 PM posted to microsoft.public.outlook.program_vba
Peter Marchert
external usenet poster
 
Posts: 116
Default How to create birthdays like Outlook does?

On 7 Dez., 21:54, Eric Legault [MVP - Outlook]
wrote:
Your code works prefectly fine on Outlook 2007 - weird.


Please have a closer look to the created appointment, especially to
the appointments recurrence and the posted properties.

Peter

--
Infos, workshops & software for
Outlook(R): www.outlook-stuff.com
  #4  
Old December 8th 07, 07:05 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default How to create birthdays like Outlook does?

Peter,

Comment out this line and try it again:

objRecPattern.NoEndDate = True

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Peter Marchert" wrote in message
...
On 7 Dez., 21:54, Eric Legault [MVP - Outlook]
wrote:
Your code works prefectly fine on Outlook 2007 - weird.


Please have a closer look to the created appointment, especially to
the appointments recurrence and the posted properties.

Peter

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


  #5  
Old December 9th 07, 06:19 AM posted to microsoft.public.outlook.program_vba
Peter Marchert
external usenet poster
 
Posts: 116
Default How to create birthdays like Outlook does?

Thanks, Ken.

I tried it but it`s the same result. I tested it with 2003 (English)
and SP3.

Peter

On 8 Dez., 19:05, "Ken Slovak - [MVP - Outlook]"
wrote:
Peter,

Comment out this line and try it again:

objRecPattern.NoEndDate = True

--
Ken Slovak
[MVP - Outlook]http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Optionshttp://www.slovaktech.com/products.htm

"Peter Marchert" wrote in message

...



On 7 Dez., 21:54, Eric Legault [MVP - Outlook]
wrote:
Your code works prefectly fine on Outlook 2007 - weird.


Please have a closer look to the created appointment, especially to
the appointments recurrence and the posted properties.


Peter


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


- Zitierten Text anzeigen -


  #6  
Old December 10th 07, 03:22 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default How to create birthdays like Outlook does?

That's odd. I tested it here with that same exact setup and got a recurring
item with no end (infinite series). Did you delete any existing instances of
that item before testing with that line commented out?

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Peter Marchert" wrote in message
...
Thanks, Ken.

I tried it but it`s the same result. I tested it with 2003 (English)
and SP3.

Peter


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
EXPORT BIRTHDAYS INTO OUTLOOK PUZZLED IN ORLANDO Outlook - Using Contacts 3 November 8th 07 03:52 AM
Outlook birthdays Danie Eksteen Outlook - Using Contacts 2 June 13th 07 02:55 PM
How do I sort my birthdays by month I have 500 of them? Outlook Thomas Outlook - Using Contacts 2 October 31st 06 01:47 AM
why does Outlook assign times to birthdays mbryce52 Outlook - Calandaring 1 February 20th 06 03:04 PM
How do I automatically create Venutian & Mars Birthdays from contact form BJ Outlook - Using Forms 0 January 13th 06 03:05 AM


All times are GMT +1. The time now is 09:27 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.