I am trying to figure out how to create a messagebox that would trigger whenever a calendar appointment is saved without attendees (please see code below). The trouble with the code below is that it does not automatically trigger when an appointment is saved. Also, when I run the macro, I get a warning message that a program is trying to access my contacts. Is there any way to bypass that?
Dim b As New Outlook.Application
Dim a As Object
Dim x As Integer
Dim y As String
Set a = b.ActiveInspector.CurrentItem
If a.Recipients.Count = 0 Then
y = "Would you like to invite attendees?"
x = MsgBox(y, vbYesNo + vbDefaultButton1)
If x = vbYes Then
Cancel = True
I haven't done a lot of Outlook VBA, but it seems to me that you could add your code to the onSave event for the meeting request form.