Prev: Conditional Format
Next: fields
From: bobh on 15 Jan 2010 10:42 Hi, I'm hoping someone can help me understand what is going on with the following senario I have AccessXP with Outlook2007 and this vba code on a form in Access which sends an email, with Outlook 'closed' this code works as long as I attach a file. If I comment out the .Attachedment Add line with Outlook closed the code fails on the .Send line with error -> 287 - Application-defined or Object-defined Error But, with Outlook open this code works with or without the .Attachment Add line. I don't get it, why do I have to have an attachment in order to get this code to work with Outlook closed??? bobh. Dim objOutlook As Object, objMail As Object Set objOutlook = CreateObject("Outlook.Application") Set objMail = objOutlook.CreateItem(0) With objMail .To = TheTo .Subject = TheSubj .body = TheBody .Attachments.Add "c:\empty.txt" .Importance = olImportanceHigh .ReadReceiptRequested = True .Send End With 'clean up Set objMail = Nothing Set objOutlook = Nothing
|
Pages: 1 Prev: Conditional Format Next: fields |