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.
Oh, sorry, it was Dmitry that wrote the previous post, not Milan. Sorry Dmitry!
Rob