As most on this forum probably agree, it was a sad day when MS removed the activities tab. I recently can across this VBA code to create an activates search, run running it I get an error, see below in red. Is this repairable, made to work for o365?
I will also attempt to get Search for All Messages from Contact and Display in New Window working.
Thank you all in advance for your help and contributions.
I will also attempt to get Search for All Messages from Contact and Display in New Window working.
Thank you all in advance for your help and contributions.
Sub FindContactActivities()
'=================================================================
'Description: Outlook macro to find all items related to a contact
' similar to the Contact Activities feature.
'
' author : Robert Sparnaaij
' version: 1.0
' website: Reviving the Contact Activities feature in Outlook 2013 - HowTo-Outlook
'==================================================================
If Application.Session.DefaultStore.IsInstantSearchEnabled Then
Dim olkExplorer As Outlook.Explorer
Set olkExplorer = Application.Explorers.Add(Application.Session.GetDefaultFolder(olFolderInbox), olFolderDisplayNormal)
Dim oItem As Object
Set oItem = Application.ActiveInspector.CurrentItem
If oItem.Class = olContact Then
Dim myContact As Outlook.ContactItem
Set myContact = oItem
Dim myContactAddress As String
Dim myContactName As String
myContactAddress = myContact.Email1Address
myContactName = myContact.FullName
Dim olkFilter As String
'Linked Contacts
olkFilter = "contactnames" & Chr(34) & myContactAddress & Chr(34) & " OR " & Chr(34) & myContactName & Chr(34) & ")"
'From this contact
olkFilter = olkFilter & " OR " & "from" & Chr(34) & myContactAddress & Chr(34) & " OR " & Chr(34) & myContactName & Chr(34) & ")"
'To this contact
olkFilter = olkFilter & " OR " & "to" & Chr(34) & myContactAddress & Chr(34) & " OR " & Chr(34) & myContactName & Chr(34) & ")"
Call olkExplorer.Search(olkFilter, olSearchScopeAllOutlookItems)
Call olkExplorer.Display
Else
MsgBox "Please run this command from an opened Contact item.", vbExclamation, "Open a Contact item"
End If
Set olkExplorer = Nothing
Set myContact = Nothing
Else
MsgBox "Search Indexing is not enabled for this mailbox." & vbNewLine & vbNewLine & _
"If you are using an Exchange account, make sure that Cached Exchange Mode is enabled" & _
vbNewLine & vbNewLine & _
"To troubleshoot Search Indexing see: " & vbNewLine & _
"Fixing Instant Search - MSOutlook.info", _
vbExclamation, "Search Indexing not enabled"
End If
End Sub