New Calendar Appointments: Conditionally turn off reminder and show time as free

Matt Metz

New Member
Outlook version
Outlook 365 64 bit
Email Account
IMAP
Because most of the items on my calendar are for me, my default settings for new appointments are SHOW AS: BUSY and REMINDER: 45 MINUTES.

But I also put appointments for my wife on my calendar, but only as FYI for myself. I want them on my calendar, but I want them to ALWAYS be shown as SHOW AS: FREE and REMINDER: NONE.

I have used VIEW SETTINGS: CONDITIONAL FORMATTING so that appointments that contain CM (my wife's initials) in the subject are formatted as gray. But I would like Outlook to conditionally also look for CM in the subject and if found, set the SHOW AS to FREE and the REMINDER to NONE.

Is there a way to do this?

If it requires a VBA macro, can you suggest how it might be done?

PS: For reasons too complicated to go into here, I prefer NOT to set up a different calendar file for my wife.
 
It will require a macro.

This can be used as the base - then use an if statement to check the subject and if it matches, set the show as value.


Code:
'Checks to see if all day and if it has a reminder set to true
     If instr(1, Appt.subject, "CM") >0 then 

With appt
     .busystatus= olfree 
     .ReminderSet = False
     .Save
end with
    End If
 
Diane Poremsky, you have been my hero for so long. Thank you for all you have contributed over many years to our collective "Outlook Quality of Life."

If I understand correctly, I think you are saying my entire VBA Macro code will read as follows. I've removed the prompt because I don't want to be asked each time. Do I have this right?

With great appreciation,

Matt
--------------------------------
Private Sub Items_ItemAdd(ByVal Item As Object)
On Error Resume Next
Dim Appt As Outlook.AppointmentItem

If TypeOf Item Is Outlook.AppointmentItem Then

Set Appt = Item

'Checks to see if appt subject includes "CM"
If instr(1, Appt.subject, "CM") > 0, then

With appt
.busystatus= olfree
.ReminderSet = False
.Save

End If
End If
End Sub
-----------------------------------------
 
I think another argument is needed in the instr function, and there's a superfluous comma. I think it should read
If instr(1, Appt.subject, "CM", 1) > 0 then
 
Diane,

After setting up my new computer (now Windows 11 Pro) and installing Microsoft 365, this macro is only doing one-half of what it was doing on the old computer. For new appointments with CM in the subject, it IS setting the time as free, but it is NOT turning off the reminder. It's leaving the reminder at the 45 minute default value. Do you know what might be causing this new behavior?

Here is the script as it is today, in This Outlook Session:

Private Sub Items_ItemAdd(ByVal Item As Object)
On Error Resume Next
Dim Appt As Outlook.AppointmentItem

If TypeOf Item Is Outlook.AppointmentItem Then

Set Appt = Item

'Checks to see if appt subject includes "CM"
If InStr(1, Appt.Subject, "CM", 1) > 0 Then
Appt.BusyStatus = olFree
Appt.ReminderSet = False
Appt.Save
End If
End If
End Sub
 
Diane, this macro is not working at all now. It is NOT setting the time as free, and is NOT turning off the reminder. The same macro is working properly still on my W10 machine, but not in W11.
 
The last property is compare - it's optional.

Default is binary, which is case sensitive. It will only find CM, not cm.

Text (value 1) will match both CM and cm.
Diane, the VBA code you helped me set up in Outlook to conditionally turn off reminder and show time as free for any appointment with "CM" in the subject was working just fine on my Windows 10 machine. The same code, replicated to my Windows 11 machine, does not work. Do you know why this is and/or how to fix it?
 
Is it not working at all or only working half? Did you move the entire script or just the code you posted above? You need the app startup too. Depending on how you opened the new appt form, it could already be set to Free.

Code:
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)
On Error Resume Next
Dim Appt As Outlook.AppointmentItem

If TypeOf Item Is Outlook.AppointmentItem Then

Set Appt = Item

'Checks to see if appt subject includes "CM"
If InStr(1, Appt.Subject, "CM", 1) > 0 Then
Appt.BusyStatus = olFree
Appt.ReminderSet = False
Appt.Save
End If
End If
End Sub



It's working here -
1718856641172.png




It will show the default remind beforehand time in the list view - but the reminder icon is not present, so it won't go off.

1718856965257.png
 
Is it not working at all or only working half? Did you move the entire script or just the code you posted above? You need the app startup too. Depending on how you opened the new appt form, it could already be set to Free.

Code:
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)
On Error Resume Next
Dim Appt As Outlook.AppointmentItem

If TypeOf Item Is Outlook.AppointmentItem Then

Set Appt = Item

'Checks to see if appt subject includes "CM"
If InStr(1, Appt.Subject, "CM", 1) > 0 Then
Appt.BusyStatus = olFree
Appt.ReminderSet = False
Appt.Save
End If
End If
End Sub



It's working here -
View attachment 4197



It will show the default remind beforehand time in the list view - but the reminder icon is not present, so it won't go off.

View attachment 4199
Diane, this portion of the VBA script is not working at all. New appts created on my Windows11 machine with CM in the subject have my default "time: busy" and "reminder before: 45" that are my default values. I am using exactly the script above between
Code:
 and
. Typically I am in CALENDAR view, not list. and in the CALENDAR view, the alarm icon shows, and the appt is in red (my conditional formatting for time=busy). Opening the item shows the reminder is ON and the time is BUSY.
 
Click in the app startup macro and click Run then make a new CM event - does it work? If yes, restart Outlook and make a new event. does that work?
I appreciate your help. I followed your instructions. I opened the VBA Editor, clicked in the STARTUP section, then selected RUN > RUN SUB. I then switched over the Calendar, created a new CM TEST item, and it was NOT converted to FREE/NO ALERT - it was BUSY and (my) default 45 minute alert.

-Matt
 
I appreciate your help. I followed your instructions. I opened the VBA Editor, clicked in the STARTUP section, then selected RUN > RUN SUB. I then switched over the Calendar, created a new CM TEST item, and it was NOT converted to FREE/NO ALERT - it was BUSY and (my) default 45 minute alert.

-Matt
Copy and paste the full macro I posted last night- the app startup and the itemadd and try again - that works here so I know its good. You aren't getting an error so we know VBA is enabled.

Oh... how many calendars are in your profile? My startup macro works with the default calendar. if your calendar is not the default, the macro needs changed (or the default data file needs changed)
 
Copy and paste the full macro I posted last night- the app startup and the itemadd and try again - that works here so I know its good. You aren't getting an error so we know VBA is enabled.

Oh... how many calendars are in your profile? My startup macro works with the default calendar. if your calendar is not the default, the macro needs changed (or the default data file needs changed)
Diane, YOU DID IT AGAIN!

When I set up my new W11 computers, I was careful to set my default email account, but failed to point the default DATA FILE to the one containing my calendar. I have confirmed now that my old W10 machine was properly pointing to the proper data file, and on my W11 machines, where the VBA wasn't working, I confirmed that changing the default DATA file fixes the issue. Thank you!
 
Similar threads
Thread starter Title Forum Replies Date
A Outlook 365 New Appointments All saved to a 365 default calendar on Mac Using Outlook 0
Kika Melo Outlook Calendar deleted appointments not in Deleted Items folder Using Outlook 3
e_a_g_l_e_p_i Outlook 2021 all appointments not showing in calendar Using Outlook 2
M Calendar daily Appointments and printing Using Outlook 0
O Export Outlook calendar appointments by filters and date range Outlook VBA and Custom Forms 1
N Gathering Calendar Appointments from Calendars that synced as Contacts Exchange Server Administration 1
V importing appointments to non-default calendar? Using Outlook 1
R Make past appointments remain in calendar Using Outlook 1
T populate calendar with appointments and send reminders Using Outlook 1
Diane Poremsky Copy New Appointments to Another Calendar using VBA Using Outlook 0
Diane Poremsky How to Import Appointments into a Group Calendar Using Outlook 0
M Copy new appointments created in multiple shared calendars to another exchange calendar Outlook VBA and Custom Forms 1
R Outlook calendar appointments Free/Busy time is changing from "Busy" to "Free" Using Outlook 2
A Looping appointments in calendar Outlook VBA and Custom Forms 0
B Outlook Calendar/setting appointments Using Outlook 1
F Outlook 2007 Calendar Appointments not in Outlook Today view Using Outlook 11
N Outlook Shared appointments automatically to Private Calendar Using Outlook 1
A Synchronize Access Table with Outlook Calendar Appointments Outlook VBA and Custom Forms 3
I Adding appointments/tasks to other user's calendar Using Outlook 1
R Getting a colleagues appointments and calendar entries Using Outlook 1
Katrina Fox Missing appointments on calendar even though transferred from old pst Using Outlook 0
Horsepower Setting appointments in calendar Using Outlook 3
A OL13 Calendar, won't allow entering 2 appointments consecutively Using Outlook 4
R New computer, OL2010 unable to display shared calendar appointments Exchange Server Administration 3
C Calendar is not accepting Appointments Using Outlook 0
A Suggestions on ways to let apps create appointments in any user's calendar? Exchange Server Administration 0
D Priting only Recurring Appointments in Outlook Calendar 2010 Using Outlook 1
L Shared calendar appointments received as emails, stays in inbox! Using Outlook 1
Z Calendar Appointments Using Outlook 1
G Can't see all my appointments on Outlook calendar Using Outlook 2
R Copy Appointments to Another Exchange Calendar Using Outlook 23
Horsepower Default calendar to receive email appointments Using Outlook 5
J Calendar Appointments move when Computer Time Zone changed. Using Outlook 5
U Appointments items not showing in calendar Using Outlook 2
A Delete all appointments on calendar for week of holiday / annual leave Using Outlook 1
J Default Category foo Calendar Appointments Using Outlook 1
M Outlook Calendar Monthly View Missing Appointments Using Outlook 3
D appointments on To Do Bar don't reflect the correct Calendar Using Outlook 3
R Shared Public calendar folder changing appointments Using Outlook 1
S exceptions to recurring appointments in calendar Using Outlook 1
K Calendar Appointments after a change of Domain Controller Exchange Server Administration 0
L Block others from inserting appointments in your calendar Using Outlook 3
R Populate Form with appointments from Calendar Outlook VBA and Custom Forms 1
F Import Calendar appointments from CSV file Outlook VBA and Custom Forms 3
R outlook 2010 calendar appointments Using Outlook 2
H i ditect birthday appointments from calendar appointments Outlook VBA and Custom Forms 4
S hide details of appointments in calendar Using Outlook 8
A Calendar private appointments, an unresolved question... Outlook VBA and Custom Forms 3
N Best way to sync calendar and contacts between Outlook 365 and Outlook on iPhone Using Outlook 4
H Macro to Delete Duplicate items in Outlook calendar where title is the same and date is the same Outlook VBA and Custom Forms 0

Similar threads

Back
Top