Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Send problem with Outlook 2002

Status
Not open for further replies.

paulbent

Programmer
Mar 4, 2002
1,071
GB
I'm trying to modify some code to work with the new Tools menu layout in Outlook 2002. It sends mail waiting in the Outbox by simulating Tools | Send/Receive | Send All in the Explorer menu.

This works fine with the 2000 menu:

Code:
Set objOLCBCol = objOLApp.ActiveExplorer.CommandBars
Set objOLCB = objOLCBCol("Menu Bar")
Set objOLPop = objOLCB.Controls("Tools")
Set objOLCtl = objOLPop.Controls("Send")
objOLCtl.Execute

This fails in 2002:

Code:
Set objOLCBCol = objOLApp.ActiveExplorer.CommandBars
Set objOLCB = objOLCBCol("Menu Bar")
Set objOLPop = objOLCB.Controls("Tools")
Set objOLPop = objOLPop.Controls("Send/Receive")
Set objOLCtl = objOLPop.Controls("Send All")
objOLCtl.Execute

The Execute method raises run-time error -2147467259 (&H80004005). This appears to be a "blanket" error when a method call to an automation server fails. In debug, all the object references appear to be set correctly. The objOLCtl object has a caption of "&Send All" and Id of 5577. The only articles I could find on this error and command bar controls is that it can occur if the control is not visible or disabled; neither of these apply in this case.

However, if I reference the next command in the Send/Receive submenu, "Send and Receive All", it works fine.

Code:
Set objOLCtl = objOLPop.Controls("Send and Receive All")
objOLCtl.Execute

Anybody come accross this and have a workaround or can confirm it's a bug?

Paul Bent
Northwind IT Systems
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top