Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-09-2022, 11:38 PM
Primaxh Primaxh is offline Automatically set Appointment as "private" or private appointments into category Windows 10 Automatically set Appointment as "private" or private appointments into category Office 2016
Novice
Automatically set Appointment as "private" or private appointments into category
 
Join Date: May 2022
Posts: 1
Primaxh is on a distinguished road
Unhappy Automatically set Appointment as "private" or private appointments into category

Hello there,



I am not very good at VBA but with the help of google I found a VBA code which should helped me out but doesnt work...

What I want Outlook to do:
If I create a new appointment and set it as "private" I want it to automatically set it as colour-categore named "pirvate" and reversed...

The VBA-code I found was:

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)
Dim Appt As Outlook.AppointmentItem
Dim CategoryName as String

CategoryName = "Sample"

If TypeOf Item Is Outlook.AppointmentItem Then
Set Appt = Item
If Appt.Sensitivity = olPrivate Then
If Appt.Categories = "" Then
Appt.Categories = CategoryName
Appt.Save
End If
ElseIf InStr(1, Appt.Categories, CategoryName, vbTextCompare) Then
Appt.Sensitivity = olPrivate
Appt.Save
End If
End If
End Sub



Can someone help me troubleshoot?

Thanks!
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Do you have Private Use Area in your Word - use of private characters messgchr Word 2 07-20-2020 08:28 PM
Outlook 2010 - Color Private appointments marcc Outlook 0 03-09-2012 03:21 AM
Access MD's private appointments in calendar elinormcl27 Outlook 0 02-28-2012 04:10 AM
Automatically set Appointment as "private" or private appointments into category Outlook specific permissions to delegates- private appointments fgiorgio79 Outlook 5 04-01-2011 04:45 PM
PA To the CEO Can't Edit Private Appointments Outlook 2007 Neil Parry Outlook 0 03-29-2009 10:05 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:53 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft