resend email from calendar event?

M

Mr . .

I'd like to send an email weekly at a certain time. I've been searching
around on the web and found a post with the following text/code.
Can someone expound a bit for me? is the "ThisOutlookSession" the name of a
macro? What about the "public / private"?

Question: How can you get VBA in outlook to send a message on a daily or
weekly basis?

Thanks To andrzej and www.outlookvba.com for this answer!

Set up a folder in your inbox called News Put your email in here
Set a recuring appointment in the calender with the subject new, to recur
when you want the email sent also set a reminder.

in ThisOutlookSession add the following:

Public WithEvents myOlItems As Outlook.Items

Private Sub Application_Reminder(ByVal Item As Object)

'wait for reminder
If Item.Sensitivity <> olConfidential Then
If TypeOf Item Is AppointmentItem Then SendApptReminder Item
End If

End Sub

Private Sub SendApptReminder(ByRef Item As AppointmentItem)

'Test the Subject of Reminder
If Item.Subject = "news" Then sendpage2 Else

End Sub
'Send news letter

Private Sub sendpage2()

Set ol = New Outlook.Application
Set olns = ol.GetNamespace("MAPI")
Set MyInboxFolder = olns.GetDefaultFolder(olFolderInbox)
Set myNewsletter = MyInboxFolder.Folders("News")
Then
Set mynews = myNewsletter.Items(1)
mynews.send

End Sub
 
S

Sue Mosher [MVP-Outlook]

The first time you use Alt+F11 to open the Outlook VBA environment, you'll see that it contains a single built-in module, named ThisOutlookSession. You can put all your code there.

FYI, there is a newsgroup specifically for general Outlook programming issues "down the hall" at microsoft.public.outlook.program_vba or, via web interface, at http://www.microsoft.com/office/community/en-us/default.mspx?dg=microsoft.public.outlook.program_vba

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top