B
Bruce
I am creating an application (lack of a better term, similair to an auto
responder, but just as far as the "ADD ME and REMOVE ME are concerned... It
is a Prayer List for may church) I want to basically have it so that it will
be have as follows:
First, if some body sends me a request for a prayer, I will enter this into
excel, and will have the following columns:
Name, Type of Prayer, Details, and Parish
I will then create an email with the following code: I am not sure how to
use a DIST LIST in the TO, and how to format part of the body (where I am
pasting in the excel data (see comments in code)
Sub CreateMail()
Dim ol As Outlook.Application
Dim mi As MailItem
Dim MyHtm As String
Dim AutoSig As String
Dim TheSig As String
TheSig = "Please have the following in your heart and prayers:"& vbCrLf
Set ol = New Outlook.Application
Set mi = ol.CreateItem(olMailItem)
mi.Display
TheSig = theSig & ActiveCell.Offset(0, 1).Value & "," &
ActiveCell.Offset(0, 2).Value & _
"," & ActiveCell.Offset(0, 3).Value & "," & ActiveCell.Offset(0, 4).Value
' instead of comma, I would like to have a actual tab. I have tried the
vbtab, but that just does not do what I want. (or maybe I can insert a
"table" and stuff them with the info from the cells?)
mi.To = ?????? This would be a DIST list, I am NOT sure how to do this..
mi. Body = thesig
mi.ReadReceiptRequested = True
mi.OriginatorDeliveryReportRequested = True
mi.Subject = "Please pray for the enclosed"
End Sub
I also want to have the "Remove Me" and "Add Me" to automatically remove or
add the person to the dist list (I would LIKE to do a double opt in, but I
have NO idea on how to get THAT sofisicated!)
For the REMOVE ME, I would have a RULE, that , if the SUBJECT is REMOVE ME
and through the given account, a SCRIPT would be ran, and then the email
address would be passed to the following code ( used the example from the
HELP and modified it, do I need to .add in order to remove?) (What kind of
error checking should be put in place?):
function RemoveRequest(mi as mailitem) Dim olApp As Outlook.Application
Dim objDstList As DistListItem Dim objName As NameSpace Dim objSender
As SenderName Dim objMail As MailItem Set olApp = Outlook.Application
Set objName = olApp.GetNamespace("MAPI") Set objDstList =
objName.GetDefaultFolder(olFolderContacts).Items("PrayerList") Set
objMail = olApp.CreateItem(olMailItem) Set objSender =
objMail.senderName.Add(Name:= objSender) ' is this correct? Is this
required? objDstList.RemoveMember SenderName:=objSender End Sub
The ADD ME should be basically the same, I think....
Thanks!
Bruce
responder, but just as far as the "ADD ME and REMOVE ME are concerned... It
is a Prayer List for may church) I want to basically have it so that it will
be have as follows:
First, if some body sends me a request for a prayer, I will enter this into
excel, and will have the following columns:
Name, Type of Prayer, Details, and Parish
I will then create an email with the following code: I am not sure how to
use a DIST LIST in the TO, and how to format part of the body (where I am
pasting in the excel data (see comments in code)
Sub CreateMail()
Dim ol As Outlook.Application
Dim mi As MailItem
Dim MyHtm As String
Dim AutoSig As String
Dim TheSig As String
TheSig = "Please have the following in your heart and prayers:"& vbCrLf
Set ol = New Outlook.Application
Set mi = ol.CreateItem(olMailItem)
mi.Display
TheSig = theSig & ActiveCell.Offset(0, 1).Value & "," &
ActiveCell.Offset(0, 2).Value & _
"," & ActiveCell.Offset(0, 3).Value & "," & ActiveCell.Offset(0, 4).Value
' instead of comma, I would like to have a actual tab. I have tried the
vbtab, but that just does not do what I want. (or maybe I can insert a
"table" and stuff them with the info from the cells?)
mi.To = ?????? This would be a DIST list, I am NOT sure how to do this..
mi. Body = thesig
mi.ReadReceiptRequested = True
mi.OriginatorDeliveryReportRequested = True
mi.Subject = "Please pray for the enclosed"
End Sub
I also want to have the "Remove Me" and "Add Me" to automatically remove or
add the person to the dist list (I would LIKE to do a double opt in, but I
have NO idea on how to get THAT sofisicated!)
For the REMOVE ME, I would have a RULE, that , if the SUBJECT is REMOVE ME
and through the given account, a SCRIPT would be ran, and then the email
address would be passed to the following code ( used the example from the
HELP and modified it, do I need to .add in order to remove?) (What kind of
error checking should be put in place?):
function RemoveRequest(mi as mailitem) Dim olApp As Outlook.Application
Dim objDstList As DistListItem Dim objName As NameSpace Dim objSender
As SenderName Dim objMail As MailItem Set olApp = Outlook.Application
Set objName = olApp.GetNamespace("MAPI") Set objDstList =
objName.GetDefaultFolder(olFolderContacts).Items("PrayerList") Set
objMail = olApp.CreateItem(olMailItem) Set objSender =
objMail.senderName.Add(Name:= objSender) ' is this correct? Is this
required? objDstList.RemoveMember SenderName:=objSender End Sub
The ADD ME should be basically the same, I think....
Thanks!
Bruce