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:
This fails in 2002:
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.
Anybody come accross this and have a workaround or can confirm it's a bug?
Paul Bent
Northwind IT Systems
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