Eljefegeneo
Still trying to learn
- Local time
- Yesterday, 23:56
- Joined
- Jan 10, 2011
- Messages
- 902
I have a form that allows me to type in a Subject line, attach a file, write a short note and it is sent out to the list of clients via email. But I want to do away with the attachment; rather have it in the body of the email. Presently my code (which works quite well and was worked out on a previous post – thank you) is:
I have done extensive research looking up ways to do this, but all posts on the internet are either too confusing to me or don’t seem to work (yes, I know "doesn't work is very vague). So what I am asking at this time is a nudge in the right direction. For example, should my ".Body" be a pdf, picture, ?, etc. And where might I find some code that would give me a start. Or is it even possible with Access vba?
Code:
Dim Subj, Bdy, Attch, Eml, EmlCc As String
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb()
Set rs = db.OpenRecordset("tblEmailBlast")
With rs
rs.MoveFirst
Do While Not .EOF
'---Emails the schedule
Dim olApp As New Outlook.Application
Dim mItem As Outlook.mailitem ' An Outlook Mail item
Set olApp = CreateObject("Outlook.Application")
Set mItem = olApp.CreateItem(olMailItem)
Eml = rs("Email")
EmlCc = Nz(rs("Email2"), "")
With mItem
.To = Eml
.CC = EmlCc
.Subject = Subj
.Body = Format(Date, "Long Date") & MsgX & "Dear" & " " & rs("Fname") & " " & rs("Surname") & ":" & MsgX & Bdy & MsgX & MsgZ1
.Attachments.Add (Attch)
.Display '(Only for test purposes)
'.Send '(Only when thoroughly tested)
End With
.MoveNext
Loop
End With
rs.Close
Set mItem = Nothing
' SetOlApp = Nothing
End If
Exit Sub