| | Awarded by Microsoft: |  |
| | VBOffice Info | | Visitors | 537779 | | Impressions | 2242553 |
| |
|
| |
| Author: Michael Bauer | Homepage | | Date: 23.09.2009 | Accessed: 2273 | | | | Description
If you organize your Outlook items by categories and synchronize with a smartphone that doesn't support categories, either your data organization gets mixed up, or you have to update it manually after any sync. Users who sync the Outlook calendar with the Google calendar via SyncMyCal face the same issue.
This example demonstrates how to assign a given category to any new appointment if it's marked as private (see #1), or vice versa, how to mark an appointment private if a specific category is assigned (see #2).
To get it running, simply copy the code into the module 'ThisOutlookSession' in the VBA environment, replace the sample category by your own category name, and restart Outlook. |
Private WithEvents Items As Outlook.Items
Private Sub Application_Startup()
Dim Ns As Outlook.NameSpace
Set Ns = Application.GetNamespace("MAPI")
Set Items = Ns.GetDefaultFolder(olFolderCalendar).Items
End Sub
Private Sub Items_ItemAdd(ByVal Item As Object)
If TypeOf Item Is Outlook.AppointmentItem Then
AddCategoryToPrivateAppointment Item
End If
End Sub
Private Sub AddCategoryToPrivateAppointment(Appt As Outlook.AppointmentItem)
If Appt.Sensitivity = olPrivate Then
If Len(Appt.Categories) = 0 Then
Appt.Categories = "Private"
Appt.Save
End If
ElseIf InStr(1, Appt.Categories, "Private", vbTextCompare) Then
Appt.Sensitivity = olPrivate
Appt.Save
End If
End Sub
|
| | |
| | |  | With Category Manager you get all of your categories in a side-bar, a reminder service, synchronized with a central category list and much ... [more] |
| | |  | VBOffice Reporter calculates the sum of values from tasks, appointments, and journal entries with just a few clicks. These reports may be filtered, grouped, and exported into an Excel ... [more] |
| | |  | OLKeeper reliably prevents users from closing their Outlook window and thus possibly missing reminders or ... [more] |
| |
|