email with subject line

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?
 
S

Stockwell43

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

How to CC in an email 9
Email Issue 1
BCC Email 3
Emailing with field name in body of email 7
Email problem 5
Pull field into email 1
Bold Code 2
SendObject Action Message 1

Top