Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming VBA / March 2008

Tip: Looking for answers? Try searching our database.

Error "The operation failed" occurs only when Outlook is closed.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dugutigi - 13 Mar 2008 21:22 GMT
I'm using Visual Basic to create and send a message thru Outlook 2003.  It
has worked perfectly for over a year at multiple sites, and works whether or
not the user has Outlook open.

However, I have one site where an error occurs only if Outlook is closed.  
If Outlook is open, the message is sent just fine.  If Outlook is closed, the
user recieves an error message "The operation failed" upon execution of the
following line:

Set objOutlookMailItem = objOutlook.CreateItem(olMailItem)

This is very perplexing because it is only happening at one of over 100
sites.  Any help will be greatly appreciated.  Thanks.
Dmitry Streblechenko - 13 Mar 2008 23:00 GMT
Do you have something loke the following befor you execute that code?

set NS = objOutlook.GetNamespace("MAPI")
NS.Logon

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy  - Outlook, CDO
and MAPI Developer Tool

> I'm using Visual Basic to create and send a message thru Outlook 2003.  It
> has worked perfectly for over a year at multiple sites, and works whether
[quoted text clipped - 12 lines]
> This is very perplexing because it is only happening at one of over 100
> sites.  Any help will be greatly appreciated.  Thanks.
Dugutigi - 13 Mar 2008 23:28 GMT
No I don't.  I have:

   Set objOutlook = CreateObject("Outlook.Application")
   Set objOutlookMailItem = objOutlook.CreateItem(olMailItem)
   With objOutlookMailItem
       Set objOutlookRecip = .Recipients.Add(strAmName)
       objOutlookRecip.Type = olTo
       etc, etc, etc
   End With

I will try your suggestion tomorrow since the problem site is on the east
coast and they have gone home for the day.

I still don't understand why this is happening only at one of over 100 sites
which in theory have identical equipment and configurations.  But I'm happy
to have something to try.  Thank you kindly.

I will post a reply tomorrow with the results.

> Do you have something loke the following befor you execute that code?
>
[quoted text clipped - 22 lines]
> > This is very perplexing because it is only happening at one of over 100
> > sites.  Any help will be greatly appreciated.  Thanks.
Dugutigi - 14 Mar 2008 20:36 GMT
Problem solved.  The code you provided below was indeed the answer.  Thank
you very much for the prompt response.

Daniel Pitt
Seattle, WA

> Do you have something loke the following befor you execute that code?
>
[quoted text clipped - 22 lines]
> > This is very perplexing because it is only happening at one of over 100
> > sites.  Any help will be greatly appreciated.  Thanks.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.