PC Review Forums Newsgroups Microsoft Outlook Microsoft Outlook VBA Programming Setting Calendar Labels

Reply

Setting Calendar Labels

 
Thread Tools Rate Thread
Old 20-09-2003, 12:42 AM   #1
TLXL
Guest
 
Posts: n/a
Default Setting Calendar Labels


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
  Reply With Quote
Old 21-09-2003, 08:47 PM   #2
leefa
Guest
 
Posts: n/a
Default Setting Calendar Labels

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
>-----Original Message-----
>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
>.
>

  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off