Quantcast
Channel: Active questions tagged email - Stack Overflow
Viewing all articles
Browse latest Browse all 29947

Scheduled recurring email

$
0
0

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.


Viewing all articles
Browse latest Browse all 29947

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>