I have the following code which automatically sends an email based on a query (which makes a table), the code sends an email to each of the addresses that appear in the query/table.
However is there a way to modify the code so that instead of automcatically sending the email it opens Outlook up first allowing me to change the subject/message etc.
Thanks for any help in advance.
Private Sub Command282_Click()
Dim MyDb As DAO.Database
Dim rsEmail As DAO.Recordset
Dim sToName As String
Dim sSubject As String
Dim sMessageBody As String
Set MyDb = CurrentDb()
Set rsEmail = MyDb.OpenRecordset("InductionLetterSEND", dbOpenSnapshot)
Do Until rsEmail.EOF
If IsNull(.Fields(6)) = False Then
sToName = .Fields(6)
sSubject = "Invitation to World of Work Induction Course: " & .Fields(8)
sMessageBody = "Dear " & .Fields(0) & " " & .Fields(1) & "," & vbCrLf & vbCrLf & _
"Thanks," & vbCrLf & .Fields(8) & vbCrLf & .Fields(9) & vbCrLf & .Fields(10) & vbCrLf & .Fields(11) & vbCrLf & .Fields(12)
DoCmd.SendObject acSendNoObject, , , _
sToName, , , sSubject, sMessageBody, False, False
Set MyDb = Nothing
Set rsEmail = Nothing
In a word, no. You do have a couple of options to accomplish what you need. You can allow your users to enter a subject and email body in a form and use those values for sSubject and sMessageBody in your existing code. If you want the users to be able to edit the actual email you'll need to automate Outlook itself (do a search for outlook automation).