Send/Receive in IMO 
Author Message
 Send/Receive in IMO

DeliverNow will error out in IMO mode. You have to use the built-in
toolbar buttons and use the Execute method on them. Here are 2 macros
that do it, one is Send/Receive and the other is Send. If a user has
removed those buttons the code will fail though. The code sends the
currently opened item with focus, but it can be modified to do
something else.

Public Sub SendReceiveNow()
  Dim oCtl As Office.CommandBarControl
  Dim oPop As Office.CommandBarPopup
  Dim oCB As Office.CommandBar
  Dim oNS As Outlook.NameSpace
  Dim oItem As Object

  'First find and send the current item to the Outbox
  Set oNS = Application.GetNamespace("MAPI")
  Set oItem = Application.ActiveInspector.CurrentItem
  oItem.Send

  'Then use the Send/Receive on All Accounts action in the Tools
  'menu to send the item from the Outbox, and receive new items
  Set oCB = Application.ActiveExplorer.CommandBars("Menu Bar")
  Set oPop = oCB.Controls("Tools")
  Set oPop = oPop.Controls("Send/Receive")
  Set oCtl = oPop.Controls("All Accounts")
  oCtl.Execute

  Set oCtl = Nothing
  Set oPop = Nothing
  Set oCB = Nothing
  Set oNS = Nothing
  Set oItem = Nothing
End Sub

Public Sub SendNow()
  Dim oCtl As Office.CommandBarControl
  Dim oPop As Office.CommandBarPopup
  Dim oCB As Office.CommandBar
  Dim oNS As Outlook.NameSpace
  Dim oItem As Object

  'First find and send the current item to the Outbox
  Set oNS = Application.GetNamespace("MAPI")
  Set oItem = Application.ActiveInspector.CurrentItem
  oItem.Send

  'Then use the Send action in the Tools menu
  'to send the item from the Outbox
  Set oCB = Application.ActiveExplorer.CommandBars("Menu Bar")
  Set oPop = oCB.Controls("Tools")
  Set oCtl = oPop.Controls("Send")
  oCtl.Execute

  Set oCtl = Nothing
  Set oPop = Nothing
  Set oCB = Nothing
  Set oNS = Nothing
  Set oItem = Nothing
End Sub

--
Ken Slovak
[MVP - Outlook]
Lead Author, Professional Outlook 2000 Programming, Wrox Press
Co-author of "Programming Microsoft Outlook 2000", Chapters 8-13,
Appendices, Sams


Quote:
> How do I send teh Send/Receive Request from VBA in an IMO
environment (IMAP
> , POP3)?

> (PSI n an Echange Server ita can easily be accomlish using
"DliverNow" from
> CDO)



Tue, 16 Sep 2003 23:27:46 GMT  
 Send/Receive in IMO
How do I send teh Send/Receive Request from VBA in an IMO environment (IMAP
, POP3)?

(PSI n an Echange Server ita can easily be accomlish using "DliverNow" from
CDO)



Tue, 16 Sep 2003 23:13:29 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Howto programatically issue Send/Receive Command in IMO Outlook 2000 Client

2. Receiving notification on Send, Receive and Delete

3. Access: Sending/receiving text to MsgBox to automate database handling

4. Outlook Send Receive scribt problem

5. Outlook Send/Receive - Someone knows the answer

6. Outlook Send/Receive Group Failure

7. Outlook- Delayed sending and receiving

8. Can't send/receive in Outlook

9. Auto send / receive with VBA

10. outlook 2000 won't send/receive

11. Send/Receive event

12. Send/Receive in Outlook - as pop server

 

 
Powered by phpBB® Forum Software