Create outlook email from Access using VBA

D

Doug

I need to create an email message using VBA from Access. I want to create
the message and enter the 'To:', but let the user then enter the subject,
body, and send the email. When I try the code below, Outlook is never
visible so the user cannot complete the message. Can someone help me?

' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")
' Create the message.
Set objOutlookMsg = objOutlook.CreateItem(0) '(olMailItem)
With objOutlookMsg
If strrecipients <> "" Then
objOutlookMsg.to = strrecipients

End If

End With
 
J

Jeff Boyce

Doug

When does the user get to "fill" your variable "strrecipients"?

Consider using an Input() function to gather the value...

Another approach might be to use the SendObject() function.

Regards

Jeff Boyce
<Access MVP>
 
D

Doug

Jeff,
My application programatically fills in strrecipients because it know who
the email is going to. I want to show the user the email with the recipients
email address fill in and allow them to complete the rest of the email and
send it. How do I make the email visible to the user so they can complete
it?
Thx,
Doug
 
J

Jeff Boyce

My mistake... take a look at the SendObject() function. It has a True/False
syntax setting that lets you edit the email.

Regards

Jeff Boyce
<Access MVP>
 
Top