Sending email

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
 
T

Terry Kreft

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.
 

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

Top