Send email via Outlook code not work for OL2002

D

David L

I have found a problem with my VB6 application after moving to
OfficeXP.


If Outlook is not already started, following VB6 code will fail.
Outlook 2000 has no problem in executing the code and complete the
rest of the task, which is
to send an email to another intranet user via Exchange server.

Dim olApp as Outlook.Application
Dim olMsg as Outlook.MailItem

Set olApp = New Outlook.Application
Set olMsg = olApp.CreateItem(0) <--- this fails with a general
error message

In all cases, the code works fine if Outlook is already up and
running.

I am looking for a solution that does not involve the use of low level
MAPI code, use of additional add-ins, CDO, and hopefully I do not need
to ShellExecute Outlook before this code is executed.

Thanks in advance for a solution and possibly explanation of what
happened.

David
8Oct 2003
 
D

David L

Sue,

I have added the logon step as suggested by your website
post and the application still fail on the CreateItem
statement. Err is -2113732605 and
the description is "the operation failed".

I notice though the create outlook.application statement
resulted in the start of an outlook process (according to
XP task manager), and the logon line added further 2M to
my memory usage in outlook (both not listed in
applications and has no visible windows).

I am puzzled as to whether environment differences to your
setup (OL patch level, install configuration used, etc)
could have made CreateItem not work if outlook is not
already manually started.

It appear to me some security feature, maybe in an Outlook
addon or patch I do not know about, changed the
environment that breaks my previously working code.

I have stumbled into a fix (posted separately in new
thread "Fix to start Outlook 2002 CreateItem error"), but

Thanks for your suggestion.

David


-----Original Message-----
You might want to try the code sample I posted at
http://www.outlookcode.com/codedetail.aspx?id=83; it
includes a logon step, which yours seems to be missing.
 

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