Hi I have this code that automates email. i would like to use an external txt file for the body of the email because my text is rather long. Is this possible, if so how would i change my current coding?
I'm using outlook express as the email client.
here's my current code
thanks!
I'm using outlook express as the email client.
here's my current code
Code:
Private Sub cmdSend_Click()
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim strSQL As String
Dim strEmail As String
Dim strbody As String
' Return reference to current database.
Set dbs = CurrentDb
'Find record to send report of
strSQL = "SELECT EmailName " & _
"FROM mytbl"
Set rst = dbs.OpenRecordset(strSQL)
strEmailname = ""
Do While Not rst.EOF
strEmailname = strEmailname & rst("Emailname") & ";"
rst.MoveNext
Loop
strEmail = Left(strEmailname, Len(strEmailname) - 1)
strbody = vbCrLf & vbCrLf & _
"put the text you want in your email here"
' send email.
DoCmd.SendObject acSendNoObject, "", acFormatTXT, strEmail, , , strHP, strbody, False
Set dbs = Nothing
Set rst = Nothing
End Sub
thanks!