Private WithEvents Items As Outlook.Items
Private Sub Application_Startup()
Dim Ns As Outlook.NameSpace
Set Ns = Application.GetNamespace("MAPI")
Set Items = Session.GetDefaultFolder(olFolderCalendar).Parent.Folders("abc").Items
End Sub
Private Sub Items_ItemAdd(ByVal Item As Object)
'On Error Resume Next
If Item.Class = olAppointment Then
Dim objMsg As MailItem
Set objMsg = Application.CreateItem(olMailItem)
objMsg.To = "abc@mail.com"
objMsg.Subject = Item.Subject
objMsg.Body = "New appointment added to Calendar" & _
vbCrLf & "Subject: " & Item.Subject & _
vbCrLf & "Date and time: " & Item.Start
'use Display instead of Send if you want to add a note before sending
objMsg.Send
Set objMsg = Nothing
End If
End Sub
End Sub
Private Sub Application_Startup()
Dim Ns As Outlook.NameSpace
Set Ns = Application.GetNamespace("MAPI")
Set Items = Session.GetDefaultFolder(olFolderCalendar).Parent.Folders("abc").Items
End Sub
Private Sub Items_ItemAdd(ByVal Item As Object)
'On Error Resume Next
If Item.Class = olAppointment Then
Dim objMsg As MailItem
Set objMsg = Application.CreateItem(olMailItem)
objMsg.To = "abc@mail.com"
objMsg.Subject = Item.Subject
objMsg.Body = "New appointment added to Calendar" & _
vbCrLf & "Subject: " & Item.Subject & _
vbCrLf & "Date and time: " & Item.Start
'use Display instead of Send if you want to add a note before sending
objMsg.Send
Set objMsg = Nothing
End If
End Sub
End Sub