Link to home
Start Free TrialLog in
Avatar of abaines
abainesFlag for Ireland

asked on

Hardcode the reply address in an e-mail generated by MS Access.

Hi All

I have a DB that is used by a few people that generates and e-mail and sends it to the one e-mail address. When that recipient replies, the reply will go to whoever sent the e-mail. Is there any way to hardcode one e-mail address that will always receive the replies?

An abridged version of my code is as follows;

Private Sub EmailFault_Click()

 'send e-mail
        Dim objOutlook As Outlook.Application
        Dim objOutlookMsg As Outlook.MailItem
        Dim objOutlookRecip As Outlook.Recipient
        Dim objOutlookAttach As Outlook.Attachment

        'create the Outlook session
        Set objOutlook = CreateObject("Outlook.Application")

        'create the message
        Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
   
        With objOutlookMsg
            'add the recipients to the message
   
            Set objOutlookRecip = .Recipients.Add("xxx@xx.com")  'send to the user
            objOutlookRecip.Type = olTo
         
            'set the subject and body of the message

            Dim Message As String
            Dim subject_line As String
   
            subject_line = "From xx"
             
            Message = "xx.         No:" & "   " & fault_number.Value & vbCrLf & _
                      vbCrLf & _
                      vbCrLf & _
                      vbCrLf & _
                      "xx:" & vbCrLf & _
                      vbCrLf & _
                      junction_reference.Value & "          " & junction_address.Value & vbCrLf & _
                      vbCrLf & _
                      vbCrLf & _
                      vbCrLf & _
                      "xx;" & vbCrLf & _
                      vbCrLf & _
                      fault_details_1.Value & " " & fault_details_2.Value & vbCrLf & _
                      vbCrLf & _
                      vbCrLf & _
                      vbCrLf & _
                      "Reported by;" & "         " & reported_by_whom & "           " & date_reported & "     Fault reported at:   " & time_reported & vbCrLf & _
                      vbCrLf & _
                      vbCrLf & _
                      "xx." & vbCrLf

            .subject = subject_line
            .Body = Message

             
            '.Send
            .Display 'display the e-mail before sending
   
        End With

        Set objOutlookMsg = Nothing
        Set objOutlook = Nothing
       
End Sub

Is the ReplyRecipients Property relevant to this?

Thanks
Dakan
ASKER CERTIFIED SOLUTION
Avatar of mbizup
mbizup
Flag of Kazakhstan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of abaines

ASKER

Thanks mbizup.

That did the trick.

Dakan
Glad to help :-)