outlook 2002 VBA code writing: need some help automating reply emails - TechRepublic
Question
June 25, 2008 at 05:36 PM
shaun.zhang

outlook 2002 VBA code writing: need some help automating reply emails

by shaun.zhang . Updated 18 years ago

Hi,

I am having difficulties writing VBA code to automate the reply emails for people who send in their availability via Outlook.

All I need is a button that is clicked to launch a reply screen that will pre-fill all the data (ie: date, recipient, sender as well as a pre-defined template)

right now all i can do is make the button display the template but not the recipient or the sender. any light shedded would be greatly appreciated thanks.

code i wrote:

Sub ReplyToNurses()
Dim msg As Outlook.MailItem
Set msg = Application.CreateItem(olMailItem)

‘This is the genesis of the new message

Set msg = Application.CreateItem(olMailItem)
msg.Subject = “Re: availability”

msg.Body = “Dear ” & vbCrLf & vbCrLf & “Thanks for sending in your availability. We have updated the system to reflect your new availability times.” & vbCrLf & vbCrLf & “Regards,”
‘& msg.Recipient.Name

msg.Display
Set msg = Nothing
End Sub

This discussion is locked

All Comments