Davers
Well-known Member
- Joined
- Sep 17, 2002
- Messages
- 1,165
Does anyone know how to set the label color through code? I'm using this to import several hundred appointments into my Outlook Calendar, and I'd like to set the color of them to something other than white...can this be done with code?
Thanks,
Dave
Code:
Sub enterAPPT()
Dim olApp As Outlook.Application
Dim olNs As Outlook.Namespace
Dim olAppt As Outlook.AppointmentItem
Dim Calendar As Outlook.MAPIFolder
Dim Installers As Outlook.MAPIFolder
Dim olSub, myTime, myDate, myPeeps, myLoc, myCDSID, myDept As String
For Each i In Range("C16:C" & Range("C65536").End(xlUp).Row)
If i.Value = "" Then Exit For
myCell = i.Address
myTime = Format(Range(myCell).Offset(0, 6), "hh:mm AM/PM")
myDate = Range(myCell).Offset(0, 5)
myPeeps = Range(myCell).Offset(0, 3)
myLoc = Range(myCell).Offset(0, 4)
myCDSID = Range(myCell).Offset(0, 1).Value
myDept = Range(myCell).Offset(0, 2)
Set olApp = CreateObject("Outlook.Application")
Set olNs = olApp.GetNamespace("MAPI")
olNs.Logon
Set Calendar = olNs.GetDefaultFolder(olFolderCalendar)
Set olAppt = olApp.CreateItem(olAppointmentItem)
olSub = "PC Renewal Schedule"
olAppt.Start = myTime + myDate
With olAppt
.Duration = 120
.Subject = olSub
.Body = myCDSID & " - " & myPeeps & " - " & olSub
.Location = myDept & " - " & myLoc
.ReminderMinutesBeforeStart = 30
.ReminderSet = True
End With
olAppt.Save
Next
Set olApp = Nothing
Set olNs = Nothing
Set olAppt = Nothing
Set Calendar = Nothing
End Sub
Thanks,
Dave