resend email with form or from calendar appointment?

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
 
H

Hollis D. Paul

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"?
When you click on the VBA button in Outlook, it brings up the VBA project that
lies behind the Outlook application. "ThisOutlookSession" is the default code
module in that project and you have to put any subroutine (macro to you) that
you want to call from a form into that particular module. Public or Private
are assembler directives which determine of the macro entry point can be seen
(called) from code outside the module in which it is assembled.

Hollis D. Paul [MVP - Outlook]
Mukilteo, WA USA
 
K

Kim

Is there an easy way without using VBA to have Outlook send a message
everyweek at at specific day and time? I know nothing about VBA.

Thanks.

Hollis D. Paul said:
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"?
When you click on the VBA button in Outlook, it brings up the VBA project that
lies behind the Outlook application. "ThisOutlookSession" is the default code
module in that project and you have to put any subroutine (macro to you) that
you want to call from a form into that particular module. Public or Private
are assembler directives which determine of the macro entry point can be seen
(called) from code outside the module in which it is assembled.

Hollis D. Paul [MVP - Outlook]
Mukilteo, WA USA
 
H

Hollis D. Paul

Is there an easy way without using VBA to have Outlook send a message
everyweek at at specific day and time? I know nothing about VBA.
I have never needed to do this, but I found this in the Outlook 2003
help file using the query "schedule a message to be sent?"

Send a meeting request or e-mail message from a group schedule

In Calendar, on the Actions menu, click View Group Schedules.
Select the group schedule you want, and then click Open.
Do one of the following:

Send a meeting request or an e-mail message to some members only

Select the group members you want to include.
Click Make Meeting, and then click either New Meeting or New Mail
Message.
Send a meeting request or an e-mail message to all members

Click Make Meeting, and then click New Meeting with All or New Mail
Message with All.

Send a meeting request to resources

Select the group members you want to use as resources (resource: A room,
computer, or any equipment needed at a meeting. You can look up a
resource's availability, compare its schedule to yours, and block out
time in its Calendar. You invite resources to your meetings the same way
that you invite people.).
Click Make Meeting, and then click New Meeting as Resource.
Note For this procedure to work, you must have adequate permissions set
for the resource.

Hollis D. Paul [MVP - Outlook]
Mukilteo, WA USA
 
M

Mr . .

How does these steps below "resend" an email at a given interval,say every
week at 0900am?

I put this VBA code in the "ThisOutlookSession" and enabled macros for
outlook. The code did run and pull and send email with a subject of
"newsletter" I had put in my inbox's subdirectory folder called "news".

What it did not do was leave a copy of the original "newsletter" email in
the "news" subdirectory for the next time the event tried to run... so the
code still lacks something to keep a copy in the "news" folder for future
sendings.

Content of the "newsletter" would be something that I'd like to send every
week at a specific time... like every monday morning sending out some
management comment like "don't forget to submit your TPS reports"... No
really the content would be useful reminder for recipients.

Code put in the ThisOutlookSession is below:

------
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 = "newsletter" 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")
Set mynews = myNewsletter.Items(1)
mynews.send

End Sub
-----

Hollis D. Paul said:
Is there an easy way without using VBA to have Outlook send a message
everyweek at at specific day and time? I know nothing about VBA.
I have never needed to do this, but I found this in the Outlook 2003
help file using the query "schedule a message to be sent?"

Send a meeting request or e-mail message from a group schedule

In Calendar, on the Actions menu, click View Group Schedules.
Select the group schedule you want, and then click Open.
Do one of the following:

Send a meeting request or an e-mail message to some members only

Select the group members you want to include.
Click Make Meeting, and then click either New Meeting or New Mail
Message.
Send a meeting request or an e-mail message to all members

Click Make Meeting, and then click New Meeting with All or New Mail
Message with All.

Send a meeting request to resources

Select the group members you want to use as resources (resource: A room,
computer, or any equipment needed at a meeting. You can look up a
resource's availability, compare its schedule to yours, and block out
time in its Calendar. You invite resources to your meetings the same way
that you invite people.).
Click Make Meeting, and then click New Meeting as Resource.
Note For this procedure to work, you must have adequate permissions set
for the resource.

Hollis D. Paul [MVP - Outlook]
Mukilteo, WA USA
 
M

Mr . .

Mr. Hollis,

I was able to get the code to send the email from the "news" folder, but it
does not leave anything there for the next time the code runs. I created a
rule to send a CC to me when the email is sent and once it comes in it is
moved to the "news" folder. This seems to work, leaving a message in the
news folder.

Mr.
Hollis D. Paul said:
Is there an easy way without using VBA to have Outlook send a message
everyweek at at specific day and time? I know nothing about VBA.
I have never needed to do this, but I found this in the Outlook 2003
help file using the query "schedule a message to be sent?"

Send a meeting request or e-mail message from a group schedule

In Calendar, on the Actions menu, click View Group Schedules.
Select the group schedule you want, and then click Open.
Do one of the following:

Send a meeting request or an e-mail message to some members only

Select the group members you want to include.
Click Make Meeting, and then click either New Meeting or New Mail
Message.
Send a meeting request or an e-mail message to all members

Click Make Meeting, and then click New Meeting with All or New Mail
Message with All.

Send a meeting request to resources

Select the group members you want to use as resources (resource: A room,
computer, or any equipment needed at a meeting. You can look up a
resource's availability, compare its schedule to yours, and block out
time in its Calendar. You invite resources to your meetings the same way
that you invite people.).
Click Make Meeting, and then click New Meeting as Resource.
Note For this procedure to work, you must have adequate permissions set
for the resource.

Hollis D. Paul [MVP - Outlook]
Mukilteo, WA USA
 
H

Hollis D. Paul

How does these steps below "resend" an email at a given interval,say every
week at 0900am?
To get that to work, you have to create a recurrent appointment for the
specific time, and set its title to newsletter. Then set a reminder for the
appointment. The appointment will be sent at the specified lead time for
the appointment. Again, not having done this, I am not sure how you get the
subject of the reminder message to be "newsletter", but I think that is the
way it works. Also, I am not sure how you get just one reminder. You want
to watch the process to be sure that a second reminder doesn't send the
newsletter a second time, since you are putting the "source" back into the
folder where it can be sent again.

Hollis D. Paul [MVP - Outlook]
Mukilteo, WA USA
 
M

Mr . .

Well, I got the code to work, and it sends one email from news folder,but
then is gone. So the rule I set up moves a copy from the sent folder back
to the news folder so it can be sent again.

Ideally I'd like the code to send a copy of the email in the news folder and
not the actual email, that way the original source email stays in the news
folder all the time.

Can the VBA code be modified to send a copy of the emai rather than the
email itself? hmmm

Mr.
Hollis D. Paul said:
How does these steps below "resend" an email at a given interval,say every
week at 0900am?
To get that to work, you have to create a recurrent appointment for the
specific time, and set its title to newsletter. Then set a reminder for the
appointment. The appointment will be sent at the specified lead time for
the appointment. Again, not having done this, I am not sure how you get the
subject of the reminder message to be "newsletter", but I think that is the
way it works. Also, I am not sure how you get just one reminder. You want
to watch the process to be sure that a second reminder doesn't send the
newsletter a second time, since you are putting the "source" back into the
folder where it can be sent again.

Hollis D. Paul [MVP - Outlook]
Mukilteo, WA USA
 
H

Hollis D. Paul

Mr . . said:
Can the VBA code be modified to send a copy of the emai rather than the
email itself? hmmm
Yes, of course. But you will need to write some code to do it. Look on
www.outlook-code.com for example code for coping a message, and example
for creating and emailing a message using VBA.

Hollis D. Paul [MVP - Outlook]
Mukilteo, WA USA
 

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