Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming VBA / September 2003

Tip: Looking for answers? Try searching our database.

Setting Calendar Labels

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
TLXL - 20 Sep 2003 00:42 GMT
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
leefa - 21 Sep 2003 20:47 GMT
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
[quoted text clipped - 21 lines]
>tlxlatxydatadotcom
>.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.