Use the following VBA code to create a contact picker to link contacts to tasks. You can change the code to allow for a manual pick of contacts folder, ie not hardcoded. If you have contacts stored in another folder, this change will make it easier to use.
To use a folder picker with other macros, use this code snippet to bring up the dialog:
Dim objApp As Application
Dim objNS As NameSpace
Dim objFolder As MAPIFolder
Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNamespace("MAPI")
Set objFolder = objNS.PickFolder
Reconnect Links Macro
Sub ReconnectLinks() Dim objApp As Application Dim objNS As NameSpace Dim objFolder As MAPIFolder Dim colItems As Items Dim objItem As Object Dim colLinks As Links Dim objLink As Link Dim colContacts As Items Dim objContact As ContactItem Dim strFind As String Dim intCount As Integer Dim myFolder1 As MAPIFolder Set objApp = CreateObject("Outlook.Application") Set objNS = objApp.GetNamespace("MAPI") 'set contacts folder Set myFolder1 = objNS.PickFolder 'set tasks folder Set objFolder = objNS.PickFolder If TypeName(objFolder) <> "Nothing" Then 'Set colContacts = objNS.GetDefaultFolder(olFolderContacts).Items Set colContacts = myFolder1.Items Set colItems = objFolder.Items For Each objItem In colItems Set colLinks = objItem.Links intCount = colLinks.Count If intCount > 0 Then For i = intCount To 1 Step -1 Set objLink = colLinks.Item(i) On Error Resume Next If objLink.Item Is Nothing Then strFind = "[FullName] = " & AddQuotes(objLink.Name) Set objContact = colContacts.Find(strFind) If Not objContact Is Nothing Then ' remove the old link colLinks.Remove i ' add the replacement link colLinks.Add objContact End If End If Next If Not objItem.Saved Then objItem.Save End If End If Next End If Set objLink = Nothing Set colLinks = Nothing Set objItem = Nothing Set objItems = Nothing Set objFolder = Nothing Set objNS = Nothing Set objApp = Nothing End Sub Private Function AddQuotes(MyText) As String AddQuotes = Chr(34) & MyText & Chr(34) End Function
I am use VBA to open word document, however ActiveDocument was not show.
hi Diane,
could you please assist?
I would like to link my contacts with their emails and see the emails within contact's form.
(I use a custom form for my contacts, called: "0A-Contacts-text", which is stored into:"outlook:\\ΕΠΑΦΕΣ 1 ΦΕΒ 2015\*0 ΕΠΑΦΕΣ-new ALL.)".
In this form i have put a nickname for each one contact, which matches with a custom field named: "PERSON" in each one email, into the folder: "outlook:\\**007-LIVESTOCK-final\*NEW-all in one folder"
If you use 2010 or up, enabling the people pane might be easier - it will show mssages to/from the contact in a small pane at the bottom of the contact, similar to the old Activites feature. Otherwise, you need to use find or restrict to look them up. The old Outlook view control might work too.
Due to the problems with Links in 2013 will this solution work in office 2013?
I haven't tested it yet, but I am assuming that it won't.