Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2014

    Question Unanswered: Modify code so email isnt automatic


    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)
    With rsEmail
            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
                End If
    End With
    Set MyDb = Nothing
    Set rsEmail = Nothing
    End Sub

  2. #2
    Join Date
    Apr 2004
    metro Detroit
    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).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts