Macro to recode midnight appt as All Day Event

D

DrBrock

Greetings all:

I have some basic familiarity with VB, mostly in the Excel environment.
I imported some calendar items a few years ago from an old program.
All of the "all day" events imported to midnight.

I would like to run a macro that finds every appointment that starts at
12:00 am and recodes it to an All Day Event.

Any assistance greatly appreciated.

drbrock


--
DrBrock
------------------------------------------------------------------------
DrBrock's Profile: http://www.thecodecage.com/forumz/member.php?u=2283
View this thread: http://www.thecodecage.com/forumz/showthread.php?t=207780

http://www.thecodecage.com/forumz


--- news://freenews.netfront.net/ - complaints: (e-mail address removed) ---
 
K

Ken Slovak

How much help do you need?

The AllDayEvent is a Boolean property you can set to True. If you have an
AppointmentItem and it already has a start date you can just set AllDayEvent
to True, save the item and you're done.

You need to get the default Calendar folder, iterate its Items collection
and look for items starting at 12:00 AM:

Dim oCal As Outlook.MapiFolder
Set oCal = Application.Session.GetDefaultFolder(olFolderCalendar)
Dim oItems As Outlook.Items
Dim oAppt As Outlook.Appointment
Set oItems = oCal.Items
For Each oAppt In oItems
If Hour(oAppt.Start) = 0 Then
oAppt.AllDayEvent = True
oAppt.Save
End If
Next
 

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