Solved

Create a Send/Receive macro in Outlook 2010

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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Outlook.com timing out while writing email 4 45
Microsoft Edge, Outlook OWA 7 43
exchange, outlook 8 58
Outlook importing calendar entries 6 65
Outlook Free & Paid Tools
Follow this checklist to learn more about the 15 things you should never include in an email signature from personal quotes, animated gifs and out-of-date marketing content.
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…

911 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

24 Experts available now in Live!

Get 1:1 Help Now