Activities in Outlook

SMB

New Member
Outlook version
Outlook 365 64 bit
Email Account
Office 365 Exchange
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.

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
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Do you have the message open our selected?

This works with a selected contact -
 

SMB

New Member
Outlook version
Outlook 365 64 bit
Email Account
Office 365 Exchange
Diane,

Yes, thank you they both worked. I just needed to change the name of the macro (showing my novice-ness).

Do you know of a way to include tasks in these searches? I am trying to use tasks as opposed to the Journal.

I also notice I have companies in a tool I used from MapiLab, but they do to show in the folders list. That would be nice is they did.

I am trying to build the simple features I used from BCM into O365.

Thanks again for your help.

Stuart
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
The scope for that would be olSearchScopeAllOutlookItems but to/from field shouldn't work on the contact field (assuming you linked it to a contact). I'll see what needs changed to work on everything.
 
Similar threads
Thread starter Title Forum Replies Date
Werewolf Workaround for the missing Activities tab in Contact Folder Properties in Outlook 2010? Using Outlook 2
Diane Poremsky Outlook 2010 & Contact Activities Using Outlook 0
F Outlook 2010 Activities search finds nothing Using Outlook 4
J Outlook replacement options - contact journal activities lost Using Outlook 23
C Tracking Activities in Outlook Calendar Using Outlook 1
S Outlook 2010: How do you enable Contacts' Activities to search archive folders Using Outlook 6
R Outlook 2010 Contact Activities Using Outlook 14
N Moving communication history and activities from BCM to OUtlook BCM (Business Contact Manager) 2
N Moving contacts and activities from BCM to OUtlook BCM (Business Contact Manager) 4
N contact notepad 'style' getting changed after clicking and running Activities Using Outlook 2
P activities tab 2013 Using Outlook 1
J Cannot Find Activities 2010 Using Outlook 14
R Activities - Speeding up retrivel Using Outlook 1
D Outlook 365 Custom forms field limit? Outlook VBA and Custom Forms 3
W Outlook 2016 MSI - Possible to make work with O365 modern Auth & Win7? Using Outlook 4
T Outlook roaming signatures Using Outlook 4
S Adding a recipient's column to Sent folder in Outlook 2010 Outlook VBA and Custom Forms 1
J Outlook search bar in Office 2021 Professional Using Outlook 1
J PSA: How to create custom keyboard shortcut for "Paste Unformatted Text" in Outlook on Windows Outlook VBA and Custom Forms 1
C How to fix outlook continuing to prompt fo an Exchange password Using Outlook 0
C Outlook doesn't feel reliable, anymore Using Outlook 5
J Outlook 2016 Trying to get Outlook 2016 to work with Office 365 Using Outlook 0
C Outlook 365 Copy/Save Emails in Folder Outside Outlook to Show Date Sender Recipient Subject in Header Using Outlook 0
U Outlook not responding when trying to print Emails Using Outlook 5
O How to sync (one way) contacts between two Outlook (exchange) accounts? Using Outlook 0
S Sync Outlook (2021) tasks with Microsoft To Do Using Outlook 1
L Duplicate calendar entries in Outlook 365 Using Outlook 4
V Outlook 2021 Can anyone explain why my Outlook views keep changing?! Using Outlook 2
AlphonseG Outlook 365 Outlook Crashes on setting SaveSentMessageFolder Outlook VBA and Custom Forms 5
S Outlook 2021 How to customize colors Outlook 2021 & Office 2021 on PC Using Outlook 2
D Outlook 2007 Recovering E-Mails Using Outlook 0
G Stop Outlook 365 adding meetings to calendar Using Outlook 2
HarvMan Using Emojis in Outlook 365 Using Outlook 3
T Outlook 2019 Not Using Auto Compete After Deletion of 365 Using Outlook 1
D Gmail mail is being delivered to a different email inbox in Outlook App 2021 Using Outlook 2
Albert McCann Outlook 2021 Outlook Display of HTML Email from two senders is glitchy Using Outlook 0
richardwing Outlook 365 VBA to access "Other Actions" menu for incoming emails in outlook Outlook VBA and Custom Forms 0
J Unable to delete folders in Outlook 2019 / Windows Using Outlook 1
K Outlook for Mac problems Using Outlook 0
D Outlook app 2021 & iCloud PST issues Using Outlook 2
M c# vsto Outlook.ApplicationEvents_11_NewMailEx Outlook VBA and Custom Forms 1
J Event/Meeting in Outlook Does Not Align with SharePoint Calendar Using Outlook 5
Christopher M Is it me, or is Outlook 365 BUGGY? Using Outlook 3
U Outlook on the iPhone cannot approve filtered Emails Using Outlook 0
J GoDaddy migrated to Office365 - Outlook Wont Add Account Exchange Server Administration 21
K Outlook 365 After migrating to Outlook 365, some contacts display in emails with prefixes Using Outlook 1
J Outlook Rules VBA Run a Script - Multiple Rules Outlook VBA and Custom Forms 0
Horsepower Cannot delete gmail in iPhone Outlook outbox Using Outlook 1
F Outlook 2019 Outlook 2019 Add and Sync to New computer Comcast server Using Outlook 2
M Understanding Outlook Identities Using Outlook 1

Similar threads

Top