email with subject line

  • Thread starter Thread starter Ruth
  • Start date Start date
R

Ruth

Hi there

I had help to create a button on a form that opens Outlook on click. The
code used is:

Private Sub Command244_Click()
On Error GoTo EH
DoCmd.SendObject
EH:
If Err.Number = 2501 Then
MsgBox "This email message has not been sent. Message has been cancelled."
End If

End Sub


I want the subject line to automatically say "Morning Report" is there
coding that I can add to do this?
 
Hi Ruth,

Try replacing your code with this code and in MySubject replace Loan
Alert!!! with what you want it to say. This way, if you ever have a send to
or Copy email that is regular you can use this code for that as well. It
works for me but try it out and let me know.

Thanks!!

On Error GoTo EH
Dim SendTo As String, SendCC As String, MySubject As String
SendTo = ""
SendCC = ""
MySubject = "Loan Alert!!!"
DoCmd.SendObject acSendNoObject, , , SendTo, SendCC, , MySubject, True


EH:
If Err.Number = 2501 Then
MsgBox "This email message has not been sent. Message has been
cancelled."
End If
End Sub
 
Back
Top