Solved

Create a Send/Receive macro in Outlook 2010

Posted on 2011-09-23
3
912 Views
Last Modified: 2012-05-12
Hi folks,

I hope you can help.

I know how to assign a macro to a custom ribbon but what I don't know is the correct code/syntax to achieve the desired outcome when a custom button is executed!

I have a couple of Send and Receive Groups defined in Outlook 2010.  One of them will only work when I'm connected via VPN to the office and the other will only work when I'm NOT connected via VPN.  What I'd ideally like is to have a couple of custom buttons that executes either Send/Receive Group 1 or Group 2.  Can you offer me some sample vba macro code that would achieve this?

Many thanks in advance for any help you feel able to give.
0
Comment
Question by:BabyFaceLima
  • 2
3 Comments
 
LVL 76

Accepted Solution

by:
David Lee earned 400 total points
ID: 36590710
Hi, BabyFaceLima.

Here's the code for doing what you described.  Duplicate the code once, changing the name of the send receive group, for each button.
Sub SendReceiveGroup1()
    Dim olkSync As Outlook.SyncObject
    'Change the send/receive group name on the next line'
    Set olkSync = Session.SyncObjects("SomeSendReceiveGroupName")
    olkSync.Start
End Sub

Open in new window

0
 

Author Closing Comment

by:BabyFaceLima
ID: 36592065
Thanks you so much.  That's excellent!
0
 
LVL 76

Expert Comment

by:David Lee
ID: 36592807
You're welcome.
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question