Change appointment alldayevent property


Joined
Sep 3, 2009
Messages
3
Reaction score
0
Hi Everyone,

I'm new to this site and VBA in Outlook and so apologies if what I've done is totally wrong. I'd like to go through a number of selected appointments and change the 'Alldayevent' attribute of each appointment from say false to true. My code seems to work (by looking at the debug.print info) but when you look at the actual appoinment in the normal outlook window which was selected it doesn't seem to have changed.

The issue I suspect is something rather simple but I'm new to this and so hope someone can help.

Many thanks in advance

Rodp

using Outlook 2000, WinXP SP2

Code:
Sub ChangeAppointmentItem()
Dim objNS As Outlook.NameSpace
Dim objAppt As Outlook.AppointmentItem
Dim objCopiedAppt As Outlook.AppointmentItem
If ActiveExplorer.Selection.Count = 0 Then Exit Sub 
 
Set objNS = Application.GetNamespace("MAPI")

For Each objAppt In ActiveExplorer.Selection
Debug.Print objAppt.Subject & " " & Format(objAppt.Start, "dd/mm/yy hh:mm") & ", " & objAppt.AllDayEvent

Debug.Print objAppt.AllDayEvent

objAppt.AllDayEvent = True

Debug.Print objAppt.AllDayEvent

Next
Set objAppt = Nothing
Set objCopiedAppt = Nothing
Set objNS = Nothing

End Sub
 
Ad

Advertisements

Joined
Sep 3, 2009
Messages
3
Reaction score
0
bump....

anyone anyone? Still trying to figure out what I need to do but so far haven't figured it out... hope some one can help soon..

Many thanks in advance

RodP
 
Joined
Sep 28, 2009
Messages
1
Reaction score
0
It's been awhile now, and I've just run into the same issue that you're having. I looked up the API for AppointmentItem.AllDayEvent on MSDN, but there wasn't much information. I continued to search MSDN and found it under the CDO API. Nevertheless, it gave me the information that I needed to fix the problem:
The AllDayEvent property contains True if the appointment takes up one or more entire days in the calendar ... you must set [StartTime and EndTime] to the same time of day, such that their values differ by a nonzero multiple of 24 hours.
When I thought about it, it made sense: An "All Day Event" can't be all day if it's from January 1st, 12am to January 1st, 12am. Just set EndTime to the day after the appointment.
 
Ad

Advertisements

Joined
Sep 3, 2009
Messages
3
Reaction score
0
Hi Hue03,


Thanks for the reply - was having a problem with amending it and then actually saving the change but got some help on this.... after all that there was a .save syntax which is what I was looking for in the first place. Cheers
Rodp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top