A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook - General Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

AccessXP email thru Outlook2007



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old January 15th 10, 04:27 PM posted to microsoft.public.outlook
bobh
external usenet poster
 
Posts: 6
Default AccessXP email thru Outlook2007

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
Ads
 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I get email in Outlook Express on an XP machine into Outlook2007 on Windows 7 Machine? MikeH[_2_] Outlook - General Queries 8 November 21st 09 11:35 PM
Outlook2007 Rick Outlook - Installation 4 March 16th 09 11:48 AM
TO and CC email addresses hidden when forwarding an email [Outlook2007] Chris Wood Outlook - General Queries 3 January 6th 09 06:56 PM
outlook2007 contact not displayed when writing email Cliff Outlook - General Queries 1 July 4th 07 11:26 PM
Outlook2007 - email on server 4Callanans Outlook - General Queries 3 February 10th 07 10:50 PM


All times are GMT +1. The time now is 02:54 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.