• Outlook 2k Code (Office 2000 Premium)

    Author
    Topic
    #358288

    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

    Viewing 0 reply threads
    Author
    Replies
    • #534542

      Great idea. Can you port it to Palm? wink

      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.

      • #534666

        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 (http://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

    Viewing 0 reply threads
    Reply To: Outlook 2k Code (Office 2000 Premium)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: