H
Henry
Hello, I want to copy a list of email address from one of my table (called
Hotel Database) into the "To" of an email that I will then finish off
manually. I cannot and tried hard now to make this work; I am stuck with on
how to copy that list of emails (in a colum called "Email GM") onto the TO of
my email body. Here is my code below! thank you!!
Public Function SendEMail()
Dim db As DAO.Database
Dim MailList As DAO.Recordset
Dim MyOutlook As Outlook.Application
Dim MyMail As Outlook.MailItem
Dim Subjectline As String
Dim BodyFile As String
Dim fso As FileSystemObject
Dim MyBody As TextStream
Dim recordEmailGM As Recordset
Set fso = New FileSystemObject
Subjectline$ = InputBox$("Please enter the subject line for this mailing.", _
"Subject Line Required!")
Set MyOutlook = New Outlook.Application
Set db = CurrentDb()
Set MailList = db.OpenRecordset("Email_GM", dbOpenTable) . THIS IS WHERE
IT DOES NOT WORK
Set MyMail = MyOutlook.CreateItem(olMailItem)
MyMail.To = MailList("email")
MyMail.Subject = Subjectline$
End Function
Hotel Database) into the "To" of an email that I will then finish off
manually. I cannot and tried hard now to make this work; I am stuck with on
how to copy that list of emails (in a colum called "Email GM") onto the TO of
my email body. Here is my code below! thank you!!
Public Function SendEMail()
Dim db As DAO.Database
Dim MailList As DAO.Recordset
Dim MyOutlook As Outlook.Application
Dim MyMail As Outlook.MailItem
Dim Subjectline As String
Dim BodyFile As String
Dim fso As FileSystemObject
Dim MyBody As TextStream
Dim recordEmailGM As Recordset
Set fso = New FileSystemObject
Subjectline$ = InputBox$("Please enter the subject line for this mailing.", _
"Subject Line Required!")
Set MyOutlook = New Outlook.Application
Set db = CurrentDb()
Set MailList = db.OpenRecordset("Email_GM", dbOpenTable) . THIS IS WHERE
IT DOES NOT WORK
Set MyMail = MyOutlook.CreateItem(olMailItem)
MyMail.To = MailList("email")
MyMail.Subject = Subjectline$
End Function