I'm using VBA code to transfer data from MS Access into our MS Outlook calendar. We are using Access and Outlook 2002 SP 3.
The code below works like a champ to loop through my Access query and put the data into the Outlook calendar. But the Outlook calendar allows you to color-code entries using the Label attribute. I can't figure out how to do this using the code. No matter what I try, VBA does not seem to recognize a label attribute. How can I use VBA to color-code my appointments?
The code I'm using is:
The code below works like a champ to loop through my Access query and put the data into the Outlook calendar. But the Outlook calendar allows you to color-code entries using the Label attribute. I can't figure out how to do this using the code. No matter what I try, VBA does not seem to recognize a label attribute. How can I use VBA to color-code my appointments?
The code I'm using is:
Code:
Do Until RM.EOF = True '(RM is my query)
Set Xtasks = olFldr.Items.Add
With Xtasks
.Start = RM!Start
.End = RM!End + 1
.Subject = RM!Title
.Body = "POC: " & RM!POC & " - " & RM!REMARKS
.Location = RM!Location
.Categories = "" & RM!IDN & ""
.AllDayEvent = True
.Save
.Close (olSave)
End With
n = n + 1
RM.MoveNext
Loop