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 and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Tags: , , , , , ,

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





 
 
Thread Tools Display Modes
  #1  
Old March 13th 08, 08:22 PM posted to microsoft.public.outlook.program_vba
Dugutigi
external usenet poster
 
Posts: 3
Default Error "The operation failed" occurs only when Outlook is closed.

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.
Ads
  #2  
Old March 13th 08, 10:00 PM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 1,429
Default Error "The operation failed" occurs only when Outlook is closed.

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

"Dugutigi" wrote in message
...
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.



  #3  
Old March 13th 08, 10:28 PM posted to microsoft.public.outlook.program_vba
Dugutigi
external usenet poster
 
Posts: 3
Default Error "The operation failed" occurs only when Outlook is close

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.

"Dmitry Streblechenko" wrote:

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

"Dugutigi" wrote in message
...
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.




  #4  
Old March 14th 08, 07:36 PM posted to microsoft.public.outlook.program_vba
Dugutigi
external usenet poster
 
Posts: 3
Default Error "The operation failed" occurs only when Outlook is close

Problem solved. The code you provided below was indeed the answer. Thank
you very much for the prompt response.

Daniel Pitt
Seattle, WA

"Dmitry Streblechenko" wrote:

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

"Dugutigi" wrote in message
...
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.




 




Thread Tools
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
"Operation Failed" error message Scoopwash Outlook - Using Contacts 2 November 26th 07 04:15 AM
Send/receive error: "Operation failed. Object could not be found" RC in Washington Outlook - Installation 0 June 25th 07 05:41 AM
"operation failed" error Mark Outlook - General Queries 1 June 4th 07 04:49 PM
"operation failed" error sherrycp Outlook - Using Contacts 1 July 22nd 06 02:42 AM
Resource Scheduling Error "The Operation Failed" outlook 2003. kunalotron Outlook - General Queries 0 March 21st 06 11:05 PM


All times are GMT +1. The time now is 07:33 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2008 Outlook Banter, part of the NewsgroupBanter project.
The comments are property of their posters.
Mortgages - Houston Sports Tickets - Car Insurance - Credit Cards - Mobile Phones