Solved

Create a Send/Receive macro in Outlook 2010

Posted on 2011-09-23
3
890 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This process describes the steps required to Import and Export data from and to .pst files using Exchange 2010. We can use these steps to export data from a user to a .pst file, import data back to the same or a different user, or even import data t…
Following basic email etiquette rules will help you write a professional email and achieve a good, lasting impression with your contacts.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

760 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now