Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Wetherby, Yorkshire, England
    Posts
    283
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Outlook 2k Code (Office 2000 Premium)

    I have written code that transfers dates from an Access 2k database to an Outlook 2k Calendar item. It works well except where the item recurs. It does not pick up the 'RecurrenceType' which should be 'olRecursDaily' but always transfers as 'olRecursWeekly'. I've even tried monthly and yearly but they all get transferred as weekly.

    The code is running from Access but I've posted it here because it refers to Outlook actions.

    Any ideas as to what I may be doing wrong?

    Peter Herworth

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Outlook 2k Code (Office 2000 Premium)

    Great idea. Can you port it to Palm? <img src=/S/wink.gif border=0 alt=wink width=15 height=15>

    What is the line of code that sets the RecurrenceType? This test code seems to work for me:

    Sub CalRecurTest()
    Dim olApp As Outlook.Application, anEvent As AppointmentItem
    Dim myRecur As RecurrencePattern
    Set olApp = CreateObject("Outlook.Application")
    Set anEvent = olApp.CreateItem(olAppointmentItem)
    With anEvent
    .ClearRecurrencePattern
    Set myRecur = anEvent.GetRecurrencePattern
    With myRecur
    .RecurrenceType = olRecursDaily
    .Interval = 2
    .PatternEndDate = #9/1/2001#
    End With
    .Save
    .Display
    End With
    Set anEvent = Nothing
    Set olApp = Nothing
    End Sub

    Interestingly, it did not work (all changes to the RecurrencePattern were ignored, and the default of weekly displayed) until I put in the call to the Save method.

  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Wetherby, Yorkshire, England
    Posts
    283
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Outlook 2k Code (Office 2000 Premium)

    Thanks for that - it works. I'm not sure what the difference is . Yours has 'myRecur' whereas I was writing it in full for each line I suspect it may be the 'ClearRecurrencePattern' entry which mine did not have. Unfortunately I made both changes without checking and I don't want to go back.

    The main difference between yours and mine is that mine allows you to choose a folder in Outlook to store it.

    I say mine - but actually I got it from the code samples on Helen Feddema's site (www.helenfeddema.com). She has one that transfers Contacts from Access(2K) to Outlook and I played around with it to transfer dates and separately to write and send emails from within Access. It's worth a visit if you want to look at automating quite a few tasks.

    Any way whatever we did it now works with daily recurring appointments - thanks.

    Peter Herworth

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •