View Single Post
  #1  
Old December 15th 06, 07:19 PM posted to microsoft.public.outlook.program_vba
JKro
external usenet poster
 
Posts: 4
Default CreateItem - Operation Failed

I have some code in an access database module that displays an email to send:

Const olMailItem As Long = 0
Const olFormatPlain As Long = 1

Dim olApp As Object
Dim objMail As Object

Set olApp = CreateObject("Outlook.Application")
Set objMail = olApp.CreateItem(olMailItem)

With objMail
.to = strEmail
.Subject = strSubject
.Body = strMessage
.attachments.Add (strAttachmentLocation)
.Display
End With

Set objMail = Nothing
Set olApp = Nothing

This code works fine on several pcs. However on at least one of my pcs, it
does not. The following line:

Set objMail = olApp.CreateItem(olMailItem)

Produces a run-time error, Operation Failed.

All of the pcs are running Outlook 2003. The versions are slightly
different (successful pc: 11.5608.5606, unsuccessful pc: 11.5608.8107) but I
don't think its the version of outlook because alot of my successfull pcs
have slightly different versions.

I checked the virus scan software and it is not blocking any outlook
scripting.

I've been banging my head against a wall for 4 days now... I can't figure
out why this same code would fail on certain pcs (with no real clues as to
why.)

Any help would be greatly appreciated!


Ads