Link to home
Start Free TrialLog in
Avatar of cacomputerguy
cacomputerguy

asked on

Changing Outlook Calendar Appointment Subject from VB Code

I have the following code:
    Dim app As New Outlook.Application
    Dim ns As NameSpace
    Dim Calendar As MAPIFolder
    Dim Item As Object
    Set ns = app.GetNamespace("MAPI")
    Set Calendar = ns.GetDefaultFolder(olFolderCalendar)
    For Each Item In Calendar.Items
        Item.Subject = "*" + Item.Subject
        DoEvents
    Next Item

From the Watch window I can see that it changes the item.subject field but it doesn't save it back to the appointment.  How do I get it to permanently update the Appointment's Subject?
ASKER CERTIFIED SOLUTION
Avatar of Helen Feddema
Helen Feddema
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of cacomputerguy
cacomputerguy

ASKER

Worked perfectly.  Is there some way to change the label color of the appointment as well as the subject?  Thanks very much.
This depends on the version.  In Outlook 2007 and 2010, colors can be associated with categories, so all you need to do it set the category (field name:  Categories) to a specific value, and then the appointment label will have that color.  For earlier versions, I don't think this is possible.
Here is the Color Categories dialog
Color-Categories.jpg