Send/Receive email automation with Outlook 2000 
Author Message
 Send/Receive email automation with Outlook 2000

Hello,
Can anyone tell me how to send/receive emails from Access 97
without having to open Outlook first?
I've tried using the code below but it only works if Outlook
is open. I need to have Outlook run in the background and not
open up at all.
Thanks.
Raul.

---------------------------------------------
Public Sub SendReceiveNow()
    Dim objOutlook As Outlook.Application
    Dim objCtl As Office.CommandBarControl
    Dim objPop As Office.CommandBarPopup
    Dim objCB As Office.CommandBar
    Dim objItem As Object

    On Error Resume Next

    Set objOutlook = CreateObject("Outlook.Application")

    Set objItem = objOutlook.ActiveInspector.CurrentItem
    objItem.Send

    Set objCB = objOutlook.ActiveExplorer.CommandBars("Menu Bar")
    Set objPop = objCB.Controls("Tools")
    Set objPop = objPop.Controls("Send/Receive")
    Set objCtl = objPop.Controls("All Accounts")
    objCtl.Execute

    Set objCtl = Nothing
    Set objPop = Nothing
    Set objCB = Nothing
    Set objItem = Nothing
    Set objOutlook = Nothing
End Sub



Tue, 01 Nov 2005 19:02:58 GMT  
 Send/Receive email automation with Outlook 2000
ActiveInspector is only available if Outlook is open with an open
item.  If all you want to do is do a send/receive then remove these
lines:
     Set objItem = objOutlook.ActiveInspector.CurrentItem
     objItem.Send

However, the code you cite, which looks like it comes from my Web
site, won't work in Outlook 97 or Outlook 98. It will only work in
Outlook 2000 and later.

For earlier versions of Outlook I'd use CDO and its DeliverNow method.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Lead Author, Professional Outlook 2000 Programming, Wrox Press
Lead Author, Beginning VB 6 Application Development, Wrox Press
Attachment Options
http://www.slovaktech.com/attachmentoptions.htm
Extended Reminders
http://www.slovaktech.com/extendedreminders.htm


Quote:
> Hello,
> Can anyone tell me how to send/receive emails from Access 97
> without having to open Outlook first?
> I've tried using the code below but it only works if Outlook
> is open. I need to have Outlook run in the background and not
> open up at all.
> Thanks.
> Raul.

> ---------------------------------------------
> Public Sub SendReceiveNow()
>     Dim objOutlook As Outlook.Application
>     Dim objCtl As Office.CommandBarControl
>     Dim objPop As Office.CommandBarPopup
>     Dim objCB As Office.CommandBar
>     Dim objItem As Object

>     On Error Resume Next

>     Set objOutlook = CreateObject("Outlook.Application")

>     Set objItem = objOutlook.ActiveInspector.CurrentItem
>     objItem.Send

>     Set objCB = objOutlook.ActiveExplorer.CommandBars("Menu Bar")
>     Set objPop = objCB.Controls("Tools")
>     Set objPop = objPop.Controls("Send/Receive")
>     Set objCtl = objPop.Controls("All Accounts")
>     objCtl.Execute

>     Set objCtl = Nothing
>     Set objPop = Nothing
>     Set objCB = Nothing
>     Set objItem = Nothing
>     Set objOutlook = Nothing
> End Sub



Tue, 01 Nov 2005 22:21:55 GMT  
 Send/Receive email automation with Outlook 2000
Hi Ken,

Quote:
> However, the code you cite, which looks like it comes from my Web
> site, won't work in Outlook 97 or Outlook 98.

The code works fine and I am using Outlook 2000 (internet only mode), but
it won't work if Outlook is not already open.
My question still stands: How can I send/receive emails without visibly
opening Outlook 2000?

Thanks for your time.
Raul.

----------------------------------------------------------------



Quote:
> ActiveInspector is only available if Outlook is open with an open
> item.  If all you want to do is do a send/receive then remove these
> lines:
>      Set objItem = objOutlook.ActiveInspector.CurrentItem
>      objItem.Send

> However, the code you cite, which looks like it comes from my Web
> site, won't work in Outlook 97 or Outlook 98. It will only work in
> Outlook 2000 and later.

> For earlier versions of Outlook I'd use CDO and its DeliverNow method.

> --
> Ken Slovak
> [MVP - Outlook]
> http://www.slovaktech.com
> Lead Author, Professional Outlook 2000 Programming, Wrox Press
> Lead Author, Beginning VB 6 Application Development, Wrox Press
> Attachment Options
> http://www.slovaktech.com/attachmentoptions.htm
> Extended Reminders
> http://www.slovaktech.com/extendedreminders.htm



Tue, 01 Nov 2005 23:00:26 GMT  
 Send/Receive email automation with Outlook 2000
I told you how, remove those 2 lines I cited.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Lead Author, Professional Outlook 2000 Programming, Wrox Press
Lead Author, Beginning VB 6 Application Development, Wrox Press
Attachment Options
http://www.slovaktech.com/attachmentoptions.htm
Extended Reminders
http://www.slovaktech.com/extendedreminders.htm


Quote:
> Hi Ken,

> > However, the code you cite, which looks like it comes from my Web
> > site, won't work in Outlook 97 or Outlook 98.

> The code works fine and I am using Outlook 2000 (internet only
mode), but
> it won't work if Outlook is not already open.
> My question still stands: How can I send/receive emails without
visibly
> opening Outlook 2000?

> Thanks for your time.
> Raul.



Wed, 02 Nov 2005 01:32:21 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. outlook 2000 won't send/receive

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

3. Activiting the send/receive button in Outlook 2000

4. How to Send/Receive emails via a .EXE without starting Outlook

5. Need OUTLOOK vbs to Send/Receive emails

6. Send/Receive All Outlook Email

7. Need OUTLOOK vbs to Send/Receive emails

8. How do you send Outlook 2000 email using WORD 97 VBA Macro

9. Sending email via Outlook from word 97/2000

10. re-sending emails automatically in outlook 2000

11. Delayed email send in Outlook 2000 - PLEASE HELP!

 

 
Powered by phpBB® Forum Software