The code below does not give compilation errors but does not send emails.
The purpose is to send recurring emails by linking them to appointments.
Private Sub Application_Reminder(ByVal Item As Object)Dim xMailItem As MailItemDim xItemDoc As Word.DocumentDim xNewDoc As Word.DocumentOn Error Resume NextIf Item.Class <> OlObjectClass.olAppointment Then Exit SubIf Item.Categories <> "Send Schedule Recurring Email" Then Exit SubSet xMailItem = Outlook.Application.CreateItem(olMailItem)Set xItemDoc = Item.GetInspector.WordEditorxItemDoc.ActivatexItemDoc.Application.Selection.WholeStoryxItemDoc.Application.Selection.CopyWith xMailItem .To = Item.Location .Subject = Item.Subject Set xNewDoc = .GetInspector.WordEditor xNewDoc.Activate xNewDoc.Application.Selection.HomeKey xNewDoc.Content.Paste .SendEnd WithSet xMailItem = NothingEnd Sub
It seems that the problem is in Item.Class. I receive a message that says
Invalid outside procedure.