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