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 Add-Ins / January 2005

Tip: Looking for answers? Try searching our database.

Trigger Send/Receive?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Milan Kosanovic - 20 Dec 2003 18:51 GMT
Can I try trigger Outlooks Send/Recieve command from my own made application
running on the same machine? My application knows there's new mail for this
specific user so I thought why not trigger Send/Receive

Milan
Dmitry Streblechenko - 20 Dec 2003 19:37 GMT
Set Btn = Application.ActiveExplorer.CommandBars.FindControl(1, 5488)

Btn.Execute

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

> Can I try trigger Outlooks Send/Recieve command from my own made application
> running on the same machine? My application knows there's new mail for this
> specific user so I thought why not trigger Send/Receive
>
> Milan
Rob Hillier - 28 Jan 2005 11:46 GMT
This'll be a long one, but I beg you to please bear with me and give me a hand if you can.

For reference, this is the path I'm dealing with throughout this post:
Application.ActiveExplorer.CommandBars("Standard").Controls.Item("Send/Re&ceive")

And here we go...

While I'm sure Milan's suggestion (previous post) works with previous versions of Outlook, it only got me so far with Outlook 2003.

When I use the .Execute method he described, I get the following amusingly enigmatic error message:

Run-time error '-2147467259 (80004005)':
Automation error
Unspecified error

I've done some research on this error, and from what I can piece together, it's really just a catch-all for pretty much any error that VBA doesn't have a specific description for.

While playing around, I noticed that if I try to fire the Execute method for a normal, standard button without any subitems (like "Reply" and "Forward"), it works fine, but if it's one of the new dual-purpose buttons that acts like a normal button and also functions as a drop-down box (like "Send/Receive"), I get the error described above.

(Told you this was a long one)

The funny thing is, while Send/Receive has subitems, it MUST have its own Execute method, because you can click it and have it send and receive.  I just can't seem to fire the event programmatically.

As a second option, I tried running the Execute method for its subitem "Send/Receive All", but "Send/Receive" doesn't have any "Controls" or "Item" properties, so I can't even figure out how to navigate the subitems, let alone execute them.

SOOOOOOO, I need to figure out how to do one of two things: Either fire the Execute method for "Send/Receive", or navigate to the subitem "Send/Receive All", and then fire its Execute method instead... Or, as a third option actually, run the appropriate API, if anyone knows what that is.

I know that I probably *could* do a SendKeys "{F9}" for this, but I'm looking for a more solid programmatic method.

Also, I realize that I could do SyncObject.Start, but I don't get the nifty progress dialog that way.

And... I'm done :)  Anyone who has read this far down:  I thank you for giving me the time.  Any help would be GREATLY appreciated.
Rob Hillier - 28 Jan 2005 11:51 GMT
Oh, sorry, it was Dmitry that wrote the previous post, not Milan.  Sorry Dmitry!

    Rob
 
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.