Results 1 to 10 of 10
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Flims, Switzerland
    Posts
    271
    Thanks
    0
    Thanked 0 Times in 0 Posts

    moving calendar items (XP SP2)

    I have the following problem:-

    I synchronise Outlook with my Palm Vx. I have recently changed timezones by 1 hour (European to UK) and now, after changing the timezone on my PC and the time on my Palm, all day events appear broken over 2 days (running from 23:00 until 23:00 the following day) in Outlook. They still appear correctly as all-day events on the Palm, however.

    A solution for this, I thought, was to write a small VBA sub which simply loops through my calendar items and, where the start time is one day before the end time and the start time is 23:00, shift the start and end times forward by one hour and then set the AppointmentItem.AllDayEvent property to True. However, this doesn't work as Outlook gives me the message "You don't have the permission to move this item" when the line of code which tries to alter the AppointmentItem.Start is run.

    Ideally, I would like to know how to avoid the above problem before it occurs, but failing this, I would like to know how I can allow my VBA to fix the symptom.

    Any tips would be greatly appreciated.

  2. #2
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Flims, Switzerland
    Posts
    271
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: moving calendar items (XP SP2)

    On further inspection, this has nothing to do with synch'ing with a Palm.

    It applies to any all day event in Outlook. If you create an all-day event and then change the timezone, the all-day event becomes broken across days. This is totally undesirable behaviour for me. Does anyone know how to avoid/fix it?

  3. #3
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: moving calendar items (XP SP2)

    No. Its an Outlook annoyance that has existed through all versions, along with the automatic default that time for an All-Day Event is set as 'Free'.
    -John ... I float in liquid gardens
    UTC -7ąDS

  4. #4
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Flims, Switzerland
    Posts
    271
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: moving calendar items (XP SP2)

    Is there any way of writing VBA code that automatically 'fixes' the items?

  5. #5
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: moving calendar items (XP SP2)

    Um ... yes?

    I don't have anything cookie-cutter for you, though I have messed a bit with it. I don't recall for certain but I think as a result of the sync process when there has been a time zone change, that the sync from the PDA sets the the .AlldayEvent Boolean Property to False; you'll have to see if that's so.

    I guess the code would loop through all calendar Items (AppointmentItems, but I prefer to use the generic Folder Items collection in case there's something in the calendar that's not the default Item Class), or maybe filtered items, check for 24 hour long events, reset the start and end times and the .AlldayEvent Property to True. The logic for figuring which day to reattach the appointment to might be a bit tricky, especially if your time zone change was more than 11 hours.

    If you write it, we shall come. <img src=/S/grin.gif border=0 alt=grin width=15 height=15>
    -John ... I float in liquid gardens
    UTC -7ąDS

  6. #6
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Flims, Switzerland
    Posts
    271
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: moving calendar items (XP SP2)

    Thanks John. This is exactly the approach I was trying and I've even written the VBA already. However, when I try and change the AllDayEvent property, or the Start or End properties, I get the message "You don't have permission to move the item." and I can't figure out a why to prevent this message and let the VBA make the changes.

  7. #7
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: moving calendar items (XP SP2)

    You are on XP, correct? In XP, looking at the VBA help, are AppointmentItem.Start and AppointmentItem.End Read/Write as they are in 2003? Outlook Methods, and Object Model & Property exposure, is changing from version to version.

    In 2003, I'm not having any trouble with

    ActiveInspector.CurrentItem.Start = DateAdd("h", -1, ActiveInspector.CurrentItem.Start)

    on a Calendar item, and it has the unanticipated bonus of automatically moving the .End time by the same interval.
    -John ... I float in liquid gardens
    UTC -7ąDS

  8. #8
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: moving calendar items (XP SP2)

    <P ID="edit" class=small>(Edited by JohnBF on 21-Jun-04 13:23. I initially confused by the appearance of an event of >= 24 hours displaying as an all day event with the "All Day Event" box being checked; an All Day Event display happens without the All day Event box checked. Also I improved the code by using the Duration Property.)</P>OK, here's some starter code. In my 2003 installation, All Day Events are 24 hours duration, and if I create a test 24 hour appointment, from noon today to noon tomorrow, without checking "All Day Event", Outlook displays it as an All Day Event, but the AllDay Event indicator isn't checked. And if I create a 72 hour appointment from noon to noon without checking "All Day Event", same thing; Outlook displays it as a multi-day All Day Event, but the AllDay Event indicator isn't checked.

    Sub calfix()
    Dim lngC As Long, lngA As Long, lng24 As Long
    With Outlook.GetNamespace("MAPI").GetDefaultFolder(olFo lderCalendar)
    For lngC = 1 To .Items.Count
    If .Items(lngC).Class = olAppointment Then
    With .Items(lngC)
    If .Start > (Date - Time) Then ' limit to todays' and future calendar items
    If .Duration = 1440 Then lng24 = lng24 + 1
    If .AllDayEvent Then lngA = lngA + 1
    Debug.Print .Subject & " appointment lasts: " _
    & Int(.Duration / 60) & Format(.Duration - Int(.Duration / 60) * 60, ":00") & "hh:mm"
    ' above formatting to show times >= 24 hours
    End If
    End With
    End If
    Next lngC
    End With
    Debug.Print vbLf & lngA & " All Day Events" & vbLf & lng24 & " 24 hour events"
    End Sub

    Good luck with the correction logic, post it back.
    -John ... I float in liquid gardens
    UTC -7ąDS

  9. #9
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Flims, Switzerland
    Posts
    271
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: moving calendar items (XP SP2)

    I am using XP, yes. I checked help and the property is, indeed, Read/Write.

    I tried that line of code in the immediate with a calendar item open and, alas, the same error occurs.

    I'm totally stumped! <img src=/S/confused.gif border=0 alt=confused width=15 height=20>

  10. #10
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: moving calendar items (XP SP2)

    <img src=/S/confused.gif border=0 alt=confused width=15 height=20> Hmm. I'm kind of stumped, here's a few possibilities. Make sure that you are set as Owner under Calendar Permissions. Also, see if it helps to digitally sign your Outlook VBA project using SelfCert.
    -John ... I float in liquid gardens
    UTC -7ąDS

Posting Permissions

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