Sending email

  • Thread starter Thread starter SF
  • Start date Start date
S

SF

Hi,

The following code send an email out directly to the receipient. Is there a
way to let user type the subject and body of the email before sending out.



Private Sub Option2_Click()
On Error GoTo Err_btnSendMail_Click

DoCmd.Hourglass True
Dim olApp As Outlook.Application
Dim olMsg As Outlook.MailItem

Set olApp = New Outlook.Application
Set olMsg = CreateItem(olMailItem)

With olMsg
.To = Me.Co_EMail
.Subject = "cmd Buttom Testing..."
.Body = "Hey delete me now"
.Send
End With
DoCmd.Hourglass False
Exit_btnSendMail_Click:
Exit Sub

Err_btnSendMail_Click:
MsgBox Err.Number & " " & Err.Description, vbOKOnly + vbInformation
Resume Exit_btnSendMail_Click
End Sub

Sf
 
Provide a form with a couple of textboxes where thy can type in what ou want
them to type nd thn use the valu of te txt fields instead of your hardcoded
strings.

You can turn off the recordselectors and navigation buttons etc to make the
form look fit for the purpose.
 
Back
Top