How to write a macro that opens a prepopulated e-mail message

M

Michelle

Hi
I am new to designing databases and would like to know how to create a macro
that I can attach to a button that would open a pre-populated message. I.e.
it will open and has the senders e-mail, subject and messae body already init.
 
D

Dale Fye

Michelle,

Lookup the SendObject method in Access Help. You would add a command button
to your form, then in the click event of the button you would do something
like:

Private Sub cmd_Email_Click

Dim strTo as string
Dim strSubject as string
Dim strBody as string

On Error goto ProcError

strTo = me.txt_To
strSubject = me.txt_Subject
strBody = me.txt_Body

docmd.SendObject acSendNoObject, , , strTo,,,strSubject, strBody

ProcExit:
Exit Sub
ProcError:
if err.number = 2501 then
'do nothing - SendObject was cancelled
else
msgbox err.number & vbcrlf & err.descrption, vbOkOnly, "Error in
cmd_Email_Click"
endif

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

Top