One of Outlook's many features is the ability to select one or more contacts and create a new message to or meeting with the contact.
To use the built in functions, select one or more contacts then click the Email or Meeting button in the Communicate group in the ribbon in Outlook 2010 and up. (Assign Task, IM, or Call are on the More menu.) In Older versions of Outlook, select the contact(s) and look on the Actions menu.
In all versions, these options are on the right-click menu as well. In Outlook 2010 and up, select the contact(s) then right click and expand Create then select Email or Meeting; in older versions, right click and expand New then select Email or Meeting.
However, when you use the "Create Meeting with Contact" function, the contact's address is not added to the location field. You can add this field (or any other contact field) to a meeting when you create the meeting using VBA.
This sample macro adds the Contact's business address, or home address if the business address is empty, to the Location field. It also adds their name and telephone number to the body of the meeting.
To use: customize the ribbon, adding a button for the macro. Then select a contact and click the button to create a new meeting. Instructions are at How to use the VBA Editor.
Sub CreateMeetingatContactLocation() Dim oOL As Outlook.Application Dim objAppt As Outlook.AppointmentItem Dim objContact As Outlook.ContactItem Dim strPhone As String Set oOL = Outlook.Application Set objAppt = oOL.CreateItem(olAppointmentItem) Set objContact = oOL.ActiveExplorer.Selection.Item(1) ' Use Business address if available, else home address If objContact.BusinessAddress <> "" Then objAppt.Location = objContact.BusinessAddressStreet & "," & objContact.BusinessAddressCity & "," & objContact.BusinessAddressState & "," & objContact.BusinessAddressPostalCode strPhone = objContact.BusinessTelephoneNumber Else objAppt.Location = objContact.HomeAddressStreet & ", " & objContact.HomeAddressCity & " " & objContact.HomeAddressState & " " & objContact.HomeAddressPostalCode strPhone = objContact.HomeTelephoneNumber End If ' Add contact's name and phone number to the body objAppt.Body = objContact.FullName & " " & strPhone objAppt.Display Set objAppt = Nothing Set objContact = Nothing Set oOL = Nothing End Sub
How to use macros
First: You will need macro security set to low during testing.
To check your macro security in Outlook 2010 or 2013, go to File, Options, Trust Center and open Trust Center Settings, and change the Macro Settings. In Outlook 2007 and older, it’s at Tools, Macro Security.
After you test the macro and see that it works, you can either leave macro security set to low or sign the macro.
Open the VBA Editor by pressing Alt+F11 on your keyboard.
To put the code in a module:
- Right click on Project1 and choose Insert > Module
- Copy and paste the macro into the new module.
More information as well as screenshots are at How to use the VBA Editor
Thank you for providing this sample macro. I have modified it a bit to use in a production service based environment and has worked out quite nicely. I have customize it to grab some additional details for the contact as well added some input boxes for specific data pertaining to scheduling.
I am wondering if you could provide me an assist with another potential modification i am trying to make.
I would like to run this macro based on an email received and considering the sender is already added to my contacts. I am having trouble calling the macro from my inbox. I have referenced several articles on creating a meeting from an email though I would like to specifically call this macro. Essentially if in email comes in and the contact information exists in my contacts the pull the information from my contact as laid out in this marco.
Thanks in advance for any assistance.