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
0
Utf
5/31/2010 7:57:01 PM
outlook.program_vba 490 articles. 0 followers. Follow

3 Replies
1398 Views

Similar Articles

[PageSpeed] 16

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
0
Utf
5/31/2010 8:06:01 PM

"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.
0
Utf
6/1/2010 1:13:01 PM
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.
0
Utf
6/1/2010 1:45:01 PM
Reply:

Similar Artilces:

Problems with creating a newsletter
I chose the form "Newsletter - email". I have created a 3 page newsletter. Now, I have NO IDEA how to send it out as an email. I do not want to send it as an attachment. I cannot figure out which "save as" format or what I need to do so that i can email this newsletter. Is there a website that goes through how to do this? Am I correct when I say that it has to be html in order for me to send it as email? That is not one of the options. Any help you give me would be greatly appreciated. Thank you, Markis www.adreamforabetterworld.com ...

VBA to check for latest version of front end?
I have a split database where the users have a local copy of the frontend. I would like to use VBA to check whether the users have the mostrecent version. I have set up the following tables:tVersion-Back-End (link to table in the BackEnd version)tVersion-FrontEnd (local table in the FrontEnd version)Each has a field Version where I am planning to put in the versionnumbers.Now, I am just starting to use VBA in my Access projects. Can someonepoint me to some coding to accomplish my task above? Can someone alsopoint me to a good resource (book, website, course) that would take mefrom a beginn...

Inbox send/receive syncronizing
New user and I'm unsure as to what I need to do to get send/receive syncronizing to happen (?or does it need to happen) faster. At this point it will not even load old or new emails. I'm nto sure what you are referrign to here. Do you mean to get the Send/Recive process happening? Have you pressed the Send / Receive button on the main Outlook toolbar? You can set a scheduled automatic Send / Receive via Ctrl + ALT + S. -- Bill R MVP "kdogg" <kdogg@discussions.microsoft.com> wrote in message news:A019B8D9-47A2-40F5-891A-A80E4378C27B@microsoft.com... > New u...

VBA training suggestions?
I'm looking for tips on software out there on learning VBA for Excel. I know how to create macros and have a good idea of what a script might look like for the macro I created. I just want to learn how to write them on my own for my personal use. Any suggestions? Thank you kindly for your input! I do not know of any software for learning VBA, but you can't go wrong looking at all the Excel VBA web sites as well as purchasing a copy of John Walkenbach's "Excel 2003 Power Programming with VBA" http://j-walk.com/ss/. Recording macros and then editing them is a pow...

Send to certain person using specific email account
I send an email to a certain receipient but don't want to use the default email account. Is it possible that when I send to them (plain text) , that it will choose the other account I want to use to send it? Please advise how I set this up. Thanks. I do not believe that this can be achieved automatically through standard use of Outlook as you need to manually specify the name of the account to send from if different than the default. However, it would be possible using the Outlook object model. An Addin would need to be developed that monitored each mail item prior to sending. If the d...

Outlook Send/Receive mail SLOW
When I receive/send email, it loads sends/receives extremely slow. The percentage indicator when receiving/sending starts at 3-5% and stays that way for awhile. After several minutes, the mail eventually comes through. Any reason for this? ...

Resolving Email Address to existing contact problem
Has anyone else come across this issue in MSCRM3.0? - when you attempt to resolve an email address to an existing contact in CRM (that does not currently have an email address stored in their details) the contact resolves OK but does not update the email address in the contacts details. Is this by design, or have I found a bug? ...

Using mouse wheel in VB editor
Just tried using the mouse wheel to scroll within visual basic editor in excel but it wont let me. How can I turn this feature on. I am using Excel 2003. Thanks in advance. This is a known problem with the latest MS mouse drivers. You can either install version 4 of the drivers (current version is 5), or use FreeWheel, and freeware program at http://www.geocities.com/SiliconValley/2060/freewheel.html . -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "fullers" <fullers@discussions.microsoft.com> wrote in message ne...

HELP Recovering addresses and email from Outlook 2003
I had some serious driver issues that required re-installing XP from disc. I did use the backup option and have a backup of all the old data. And of course had to reinstall Office 2003. Will third party software restore my old email and addresses or am I out of luck?? Thanks for the help texraid wrote: > I had some serious driver issues that required re-installing XP from > disc. I did use the backup option and have a backup of all the old > data. And of course had to reinstall Office 2003. > > Will third party software restore my old email and addresses or am I > out of lu...

VBA to creating autotext entries or quickparts in different catego
I have a VBA application that basically allows people to easily create autotext entiries, move them between machines and use them making comments on assignments. Currently it operates in EXACTLY the same way in Word 2003 and 2007 (using userforms) and I want to keep that as long as possible. You can see the application at http://emarking-assistant.baker-evans.com and either the screen image or the video demos will give you an idea of what I am doing Currently I store all the comments in a long list of autotext entries that is displayed in a field with the value of the entr...

Receiving POP3 mail into Outlook without Send/Receive
I want the POP3 mail to be received into Outlook (If open) when the mail arrives in POP3 account. Is that possible? Set an Automatic Polling Interval. --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. All unsolicited mail sent to my personal account will be deleted without reading. After furious head scratching, delanda asked: | I want the POP3 mail to be received into Outlook (If open) when the | mail arrives in POP3 account. Is that possible? ...

Use exchange from a trusted domain
Hi folks, I have domain a and domain b. Domain a is all set upp with exchange etc. Domain b was bought, and they don't have exchange. I have trust between the domains and file sharing and authentication are ok. What we want to do is, make users on domain b and let them use the exchange (on a seperate storage) on domain a. The users on domain b must logon to domain b, but need to have mailbox on domain a. Domain a are running on win2003 and exchange 2003. Domain are running on win2003 with forest and domain ready for exchange. Any advices? thanks in advance, - Bjarni Hi, Thi...

Multiple copies of email in "Forward to"contact
HIe, I am running Exchnage 2003. My CEO has a conatct in our organisation that refer to his blackberry contact. I have set the forwarding to also keep a copy in his mailbox. What happens is that three copies of his forwarded email hit his blackberry account! Only one hits his internal mailbox. What I ahve determined is that the front end Exchange server seems to be creating the additional copies. Is this how its meant to be (don think so cos its such a nuisance and my CEO keeps complaining about it). How do I tell the front end server that this guy's mail server is the one that...

Using Access 2003 on client to see Sharepoint 2007
Testing a Sharepoint environment and I can easily manipulate and run the database from Access 2007, but when I try to use Access 2003 it wants me to save the database to a location. The Access 2003 has the compatiblity pack, but it seems to not work when I download it. So the question is using Sharepoint 2007 and posting the Access 2007 format to it, can a user go to the sharepoint site and use a 2003 Access database that has the compatibility pack and open without having to download it? -- Message posted via http://www.accessmonster.com Send check for $500.00 to: David A Jenn...

Non-VBA way of making custom menus.
Sorry for the new thread but even on Google, the thread isn't showing up. Well, it was SOOO easy, as I knew it would be. The webpage I quoted in my message this morning didn't mention the "New Menu" at all! So, here is the non-VBA way to create a custom menu: - TOOLS > CUSTOMIZE - under the categories available choose NEW MENU and then drag the NEW MENU option under the Commands window up to the menu bar (like D'UH!! <lol> Wish all those hours spent searching yielded webpages that gave this! <g>) - THEN one can go back to the MACROS category a few line...

Sending Email #6
When sending e-mail I heep getting it bounced back with the following message; Your message did not reach some or all of the intended recipients. Subject: Sent: 1/12/04 4:34 PM The following recipient(s) could not be reached: 'name' on 1/12/04 4:34 PM 553 sorry, that domain isn't in my list of allowed rcpthosts (#5.7.1) Why does this keep happening? Receiving e-mail is not a problem. Generally, this error message means that the email address to which it refers is not accurate. Go to your address book and carefully check the spelling and ...

compact database in VBA access 2007
Hello, I have recently upgrade to office 2007 from office 2003. To compact a database from within the database itself, I used the follwing code. Unfortunately it no longer works in access 2007. Is there some similar code that will work? Public Function FncCompactTheCurrentDB() CommandBars("Menu Bar"). _ Controls("Tools"). _ Controls("Database utilities"). _ Controls("Compact and repair database..."). _ accDoDefaultAction End Function Thank You, SL On Thu, 28 Jan 2010 17:34:01 -0800, SL <SL@discussions.microsoft....

VBA to put a copy of worksheet on the desktop 05-13-10
Hi all, In my workbook XYZ I have a sheet ABC. With a button on sheet DEF I can refresh sheet ABC. When the code finishes it job I want to add the actual date (short European notation dmyy) and time (f.i. 241110 16.31) to the name of the sheet (which becomes ABC 241110 16.31) and after that make a copy of that sheet in a separate workbook and put that workbook as an icon on the desktop of my computer. Is this possible? If so, please help me with the necessary code. Thanks in advance for your assistance. Jack Sons The Netherlands ...

How Use ShellExecute with a CMemFile
Hello, I need to store files of various types (such as .doc, .xls, .jpg, .pdf, ..wmv, ...) in a database. Upon retrieval of such a file I have the file as data in memory in a CMemFile. I need to then "display" the file in the aproriate application. If I were to write the CMemFile to disk and create an actual file I could then, of course, use ShellExecute() to launch , say Word to display a .doc file. However, I would much prefer to avoid the overhead of writing the data to an actual file and then dealing with having to detect when the User is done and cleaning up the file I had ...

automating email marketing with workflow in CRM 4.0
Hello, I am attempting to prepare a client demo that demonstrates some of the features of Microsoft CRM 4. The potential client is a staffing agency, and I have spent some time thinking about how they might use the product. Here is a business process I have thought up that, if I could get it to work, would be great to show at a demo. 1. An account calls about an opportunity. The opportunity is entered. The opportunity has certain skills attached to it, such as: SQL Server, Linux, C#, etc 2. Contacts (candidates) also have certain skills attached to them, such as: SQL Server, Linux, C...

Can i use conditional formating on a cell when it contains a formula?
I am trying a "conditional formatting" on a cell that contains formula, but it didn't work. "If cell value is equal to 0 then font - white" This doesn't work, stays always. If i use this condition on a cell without formula it works just fine. Thank -- si ----------------------------------------------------------------------- sit's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=262 View this thread: http://www.excelforum.com/showthread.php?threadid=26784 Hi are you sure your formula returns an exact zero?. Could you post the formul...

Date function quit working
Hi, I have an Access 2002 application that I have been running on Windows XP SP2 without issue. I just installed the application (running in Access Runtime) on a Windows Vista Home Premium machine. Now, anywhere I used the =Date() function, it fails and just shows #Name? I also have a subform on one of my forms that has now gone blank. It also uses the date function. I had this problem when I converted to Windows XP several years ago and updating the OWC10.dll to version 6619 fixed both issues. However, everything I have read says that reference file makes no difference to the Access...

Using INDIRECT within functions
I learned a bit from JLathman in a previous post but tried to use the same methodology with this formula (also learned from this Group to get the last entered value in a column) without much luck. The original formula was this with 2009 sheet being static: =LOOKUP(2,1/('2009'!H3:H65536<>""),'2009'!H3:H65536) Trying to make it dynamic I tried the following without success: =LOOKUP(INDIRECT("2,1/(" & O1 & "!$H$3:$H$65536<>"")," & O1 & "!$H$3:$H$65536)")) Did I miss something or are...

CRM Email Displays Size=2>
One of my users is experiencing an issue when they save an email that is tracked within CRM the email displays in CRM with "Size=2>" directly in front of certain lines of the email. So for example "Size=2>" will appear in front of someone's comments in the email or in front of their name. Does anyone know why "Size=2>" is displaying in front of the lines of an email? Thanks. Mike H. "Mike H." wrote: > One of my users is experiencing an issue when they save an email that is > tracked within CRM the email displays in CRM wit...

Email cannot be resolved...
When you send an e-mail message from an existing Microsoft Business Solutions CRM contact, the e-mail address does not resolve to the contact record. When you view the e-mail message in Microsoft CRM, you receive the following error message: The sender's email address could not be resolved to a record in the system. At least one recipient could not be resolved to a record in the system. There is a KB article with a hotfix that addresses this issue for CRM 1.0 - has anyone had this problem in version 1.2 and been able to resolve it? Chad, I experience the same problem, though it ...