Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SendObject Method, MessageText not working

Status
Not open for further replies.

FeS2

Technical User
Aug 16, 2002
82
US
I have Office 2003 and using Outlook 2003 w/message format as rich text. When I'm running the DoCmd.SendObject acSendNoObject, , , , , , "Test", "testing", True It brings up the e-mail, the subject line but the message text of "testing" is not there. I have tried changing the message format in outlook to text and it still doesn't appear. I did have some other code in the SendObject but removed it to help test and see if it was my bad typing causing the problem but it still does not show the message text. any help will be greatly appreciated.
 
Your code works fine for me... I don't see anything wrong with it. Now, my version of Outlook is Outlook Express 6, 2004. I'm not sure if that makes a difference or not in this case, but your example worked for me. Do you have Outlook (professional) or are you using Express?
 
MS Office Outlook 2003. I also just tried this with Outlook Express and it works fine, now I just need to figure out why Office Outlook won't work. Thanks
 
Ok i got this figured out now. For outlook express the code i started with works fine. For Office Outlook you have to use the following after you load Microsoft Outlook 11.0 Object Library in the Tools, References menu.

Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient

Set objOutlook = CreateObject("outlook.application")
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
Set objOutlookRecip = .Recipients.Add("Your e-mail address")
objOutlookRecip.Type = olTo
.Subject = "This is a test."
.Body = "Hope this one works this time" & vbCrLf
.Importance = olImportanceNormal
'Use .send to send the message right away
'.Send
'Use .display to edit the message before sending it
'.Display
End With

Set objOutlook = Nothing
Set objOutlookMsg = Nothing
Set objOutlookRecip = Nothing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top