![]() |
Send All emails in Outbox and Quit using VBA
Hi,
I have MS Access creating emails objects in Outlook using a macro. I want to send them all and close outlook after. 1-Open Outlook 2-Send all emails in the outbox folder 3-Close Outlook How can I achieve it using VBA? Using command buttons does not seem to work since my Outlook is in French, I'm using Outlook 2003 SP3. Thank You Stephane |
Send All emails in Outbox and Quit using VBA
You're not trying to use command button captions, are you? Use the IDs
instead, with the FindControl method. They're language-neutral. The ID for Send All should be 5577. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "Steph_canoe" wrote: Hi, I have MS Access creating emails objects in Outlook using a macro. I want to send them all and close outlook after. 1-Open Outlook 2-Send all emails in the outbox folder 3-Close Outlook How can I achieve it using VBA? Using command buttons does not seem to work since my Outlook is in French, I'm using Outlook 2003 SP3. Thank You Stephane |
Send All emails in Outbox and Quit using VBA
"Sue Mosher [MVP]" wrote: You're not trying to use command button captions, are you? Use the IDs instead, with the FindControl method. They're language-neutral. The ID for Send All should be 5577. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "Steph_canoe" wrote: Hi, I have MS Access creating emails objects in Outlook using a macro. I want to send them all and close outlook after. 1-Open Outlook 2-Send all emails in the outbox folder 3-Close Outlook How can I achieve it using VBA? Using command buttons does not seem to work since my Outlook is in French, I'm using Outlook 2003 SP3. Thank You Stephane How would I write my code than: Public Sub SendReceiveNowDev() ' Instantiate an Outlook Application object. Set objOutlook = CreateObject("Outlook.Application") 'Set Btn = Application.ActiveExplorer.CommandBars.FindControl (msoControlButton, 5577) Btn.Execute 'Stop Outlook objOutlook.Quit End Sub Seems not to work. |
Send All emails in Outbox and Quit using VBA
Here is my updated code but is not working yet:
Public Sub SendReceiveNowDev() Dim objOutlook As Outlook.Application Dim objCB As Office.CommandBar On Error Resume Next ' Instantiate an Outlook Application object. Set objOutlook = CreateObject("Outlook.Application") 'Then use the Send/Receive on All Accounts Set objCB = Application.ActiveExplorer.CommandBar.FindControl( msoControlButton, 5577) objCB.Execute Set objCB = Nothing Set objOutlook = Nothing 'Stop Outlook objOutlook.Quit End Sub "Steph_canoe" wrote: "Sue Mosher [MVP]" wrote: You're not trying to use command button captions, are you? Use the IDs instead, with the FindControl method. They're language-neutral. The ID for Send All should be 5577. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "Steph_canoe" wrote: Hi, I have MS Access creating emails objects in Outlook using a macro. I want to send them all and close outlook after. 1-Open Outlook 2-Send all emails in the outbox folder 3-Close Outlook How can I achieve it using VBA? Using command buttons does not seem to work since my Outlook is in French, I'm using Outlook 2003 SP3. Thank You Stephane How would I write my code than: Public Sub SendReceiveNowDev() ' Instantiate an Outlook Application object. Set objOutlook = CreateObject("Outlook.Application") 'Set Btn = Application.ActiveExplorer.CommandBars.FindControl (msoControlButton, 5577) Btn.Execute 'Stop Outlook objOutlook.Quit End Sub Seems not to work. |
All times are GMT +1. The time now is 05:05 AM. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com