Setting Calendar Labels

  • Thread starter Thread starter TLXL
  • Start date Start date
T

TLXL

Can someone please help get me started in the right direction with an
Outlook macro. I am actually an Excel VBA programmer, and not very
proficient in Outlook VBA.

What I'm hoping to be able to do is scan my Calendar folder
appointments... Look for the first 3 characters in either the notes or
subject section and set the colored label (ie, Business, Personal,
Must Attend) using a SELECT command.

Something like:

For each c in ??? 'Calender items
Select Case Left(MySubj,3)
Case "BUS" then obj.Label = ??? 'Business label
Case "PER" then obj.Label = ??? 'Personal label
Case "MA" then obj.Label = ??? 'Must Attend label
End Select
Next c

I realize I'm not giving much of a template but any help would be
greatly appreciated.

tlxlatxydatadotcom
 
here is a basic macro for appointments. just open
your 'locals' pane and see the properties you can set.

Dim myOlApp As New Outlook.Application
Dim mynamespace As Outlook.NameSpace
Dim appt As AppointmentItem
Set myOlApp = CreateObject("Outlook.Application")
Set mynamespace = myOlApp.GetNamespace("MAPI")
Set myfolder = mynamespace.GetDefaultFolder
(olFolderCalendar)

Count = 1
For Each myitem In myfolder.Items
' Set MailItem = mailfolder.Items(Count)
myclass = myitem.Class
Select Case myclass
Case 26 'olAppointment 26
Set appt = myitem
Subject = appt.Subject
ID = Left(Subject, 3)
Select Case ID
Case "BUS" 'Business label
Case "PER" 'Personal label
Case "MA" 'Must Attend label
Case Else
ID = Left(Subject, 3)
Select Case ID
Case "BUS" 'Business label
Case "PER" 'Personal label
Case "MA" 'Must Attend label
End Select
End Select
Case 43 'olMail 43
x = "mail"
Case Else
MsgBox ("invalid class: " & myclass)
End Select
Count = Count + 1
Next
 
Back
Top